@@ -183,7 +183,7 @@ impl StdError for JoinPathsError {
183
183
}
184
184
185
185
#[ cfg( target_os = "freebsd" ) ]
186
- pub fn current_exe ( ) -> IoResult < Path > {
186
+ pub fn current_exe ( ) -> io :: Result < PathBuf > {
187
187
unsafe {
188
188
use libc:: funcs:: bsd44:: * ;
189
189
use libc:: consts:: os:: extra:: * ;
@@ -195,16 +195,16 @@ pub fn current_exe() -> IoResult<Path> {
195
195
let err = sysctl ( mib. as_mut_ptr ( ) , mib. len ( ) as :: libc:: c_uint ,
196
196
ptr:: null_mut ( ) , & mut sz, ptr:: null_mut ( ) ,
197
197
0 as libc:: size_t ) ;
198
- if err != 0 { return Err ( IoError :: last_error ( ) ) ; }
199
- if sz == 0 { return Err ( IoError :: last_error ( ) ) ; }
198
+ if err != 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
199
+ if sz == 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
200
200
let mut v: Vec < u8 > = Vec :: with_capacity ( sz as uint ) ;
201
201
let err = sysctl ( mib. as_mut_ptr ( ) , mib. len ( ) as :: libc:: c_uint ,
202
202
v. as_mut_ptr ( ) as * mut libc:: c_void , & mut sz,
203
203
ptr:: null_mut ( ) , 0 as libc:: size_t ) ;
204
- if err != 0 { return Err ( IoError :: last_error ( ) ) ; }
205
- if sz == 0 { return Err ( IoError :: last_error ( ) ) ; }
204
+ if err != 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
205
+ if sz == 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
206
206
v. set_len ( sz as uint - 1 ) ; // chop off trailing NUL
207
- Ok ( Path :: new ( v ) )
207
+ Ok ( PathBuf :: new :: < OsString > ( & OsStringExt :: from_vec ( v ) ) )
208
208
}
209
209
}
210
210
@@ -227,7 +227,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
227
227
unsafe {
228
228
let v = rust_current_exe ( ) ;
229
229
if v. is_null ( ) {
230
- Err ( IoError :: last_error ( ) )
230
+ Err ( io :: Error :: last_os_error ( ) )
231
231
} else {
232
232
Ok ( Path :: new ( CStr :: from_ptr ( v) . to_bytes ( ) . to_vec ( ) ) )
233
233
}
@@ -240,17 +240,17 @@ pub fn current_exe() -> io::Result<PathBuf> {
240
240
}
241
241
242
242
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
243
- pub fn current_exe ( ) -> IoResult < Path > {
243
+ pub fn current_exe ( ) -> io :: Result < PathBuf > {
244
244
unsafe {
245
245
use libc:: funcs:: extra:: _NSGetExecutablePath;
246
246
let mut sz: u32 = 0 ;
247
247
_NSGetExecutablePath ( ptr:: null_mut ( ) , & mut sz) ;
248
- if sz == 0 { return Err ( IoError :: last_error ( ) ) ; }
248
+ if sz == 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
249
249
let mut v: Vec < u8 > = Vec :: with_capacity ( sz as uint ) ;
250
250
let err = _NSGetExecutablePath ( v. as_mut_ptr ( ) as * mut i8 , & mut sz) ;
251
- if err != 0 { return Err ( IoError :: last_error ( ) ) ; }
251
+ if err != 0 { return Err ( io :: Error :: last_os_error ( ) ) ; }
252
252
v. set_len ( sz as uint - 1 ) ; // chop off trailing NUL
253
- Ok ( Path :: new ( v ) )
253
+ Ok ( PathBuf :: new :: < OsString > ( & OsStringExt :: from_vec ( v ) ) )
254
254
}
255
255
}
256
256
0 commit comments