@@ -183,7 +183,7 @@ impl StdError for JoinPathsError {
183183}
184184
185185#[ cfg( target_os = "freebsd" ) ]
186- pub fn current_exe ( ) -> IoResult < Path > {
186+ pub fn current_exe ( ) -> io :: Result < PathBuf > {
187187 unsafe {
188188 use libc:: funcs:: bsd44:: * ;
189189 use libc:: consts:: os:: extra:: * ;
@@ -195,16 +195,16 @@ pub fn current_exe() -> IoResult<Path> {
195195 let err = sysctl ( mib. as_mut_ptr ( ) , mib. len ( ) as :: libc:: c_uint ,
196196 ptr:: null_mut ( ) , & mut sz, ptr:: null_mut ( ) ,
197197 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 ( ) ) ; }
200200 let mut v: Vec < u8 > = Vec :: with_capacity ( sz as uint ) ;
201201 let err = sysctl ( mib. as_mut_ptr ( ) , mib. len ( ) as :: libc:: c_uint ,
202202 v. as_mut_ptr ( ) as * mut libc:: c_void , & mut sz,
203203 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 ( ) ) ; }
206206 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 ) ) )
208208 }
209209}
210210
@@ -227,7 +227,7 @@ pub fn current_exe() -> io::Result<PathBuf> {
227227 unsafe {
228228 let v = rust_current_exe ( ) ;
229229 if v. is_null ( ) {
230- Err ( IoError :: last_error ( ) )
230+ Err ( io :: Error :: last_os_error ( ) )
231231 } else {
232232 Ok ( Path :: new ( CStr :: from_ptr ( v) . to_bytes ( ) . to_vec ( ) ) )
233233 }
@@ -240,17 +240,17 @@ pub fn current_exe() -> io::Result<PathBuf> {
240240}
241241
242242#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
243- pub fn current_exe ( ) -> IoResult < Path > {
243+ pub fn current_exe ( ) -> io :: Result < PathBuf > {
244244 unsafe {
245245 use libc:: funcs:: extra:: _NSGetExecutablePath;
246246 let mut sz: u32 = 0 ;
247247 _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 ( ) ) ; }
249249 let mut v: Vec < u8 > = Vec :: with_capacity ( sz as uint ) ;
250250 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 ( ) ) ; }
252252 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 ) ) )
254254 }
255255}
256256
0 commit comments