File tree 2 files changed +2
-14
lines changed
2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -383,16 +383,6 @@ impl File {
383
383
pub fn set_permissions ( & self , perm : Permissions ) -> io:: Result < ( ) > {
384
384
self . inner . set_permissions ( perm. 0 )
385
385
}
386
-
387
- /// Get the path that this file points to.
388
- ///
389
- /// This function is only implemented on Redox, but could be
390
- /// implemented on other operating systems using readlink
391
- #[ cfg( target_os = "redox" ) ]
392
- #[ unstable( feature = "file_path" , issue="0" ) ]
393
- pub fn path ( & self ) -> io:: Result < PathBuf > {
394
- self . inner . path ( )
395
- }
396
386
}
397
387
398
388
impl AsInner < fs_imp:: File > for File {
Original file line number Diff line number Diff line change @@ -319,10 +319,8 @@ impl File {
319
319
320
320
pub fn path ( & self ) -> io:: Result < PathBuf > {
321
321
let mut buf: [ u8 ; 4096 ] = [ 0 ; 4096 ] ;
322
- match syscall:: fpath ( * self . fd ( ) . as_inner ( ) as usize , & mut buf) {
323
- Ok ( count) => Ok ( PathBuf :: from ( unsafe { String :: from_utf8_unchecked ( Vec :: from ( & buf[ 0 ..count] ) ) } ) ) ,
324
- Err ( err) => Err ( Error :: from_raw_os_error ( err. errno ) ) ,
325
- }
322
+ let count = cvt ( syscall:: fpath ( * self . fd ( ) . as_inner ( ) as usize , & mut buf) ) ?;
323
+ Ok ( PathBuf :: from ( unsafe { String :: from_utf8_unchecked ( Vec :: from ( & buf[ ..count] ) ) } ) )
326
324
}
327
325
328
326
pub fn fd ( & self ) -> & FileDesc { & self . 0 }
You can’t perform that action at this time.
0 commit comments