Skip to content

Commit 6378c77

Browse files
committed
Remove file path from std::fs::File
1 parent 1d0bba8 commit 6378c77

File tree

2 files changed

+2
-14
lines changed

2 files changed

+2
-14
lines changed

src/libstd/fs.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,6 @@ impl File {
383383
pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> {
384384
self.inner.set_permissions(perm.0)
385385
}
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-
}
396386
}
397387

398388
impl AsInner<fs_imp::File> for File {

src/libstd/sys/redox/fs.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -319,10 +319,8 @@ impl File {
319319

320320
pub fn path(&self) -> io::Result<PathBuf> {
321321
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])) }))
326324
}
327325

328326
pub fn fd(&self) -> &FileDesc { &self.0 }

0 commit comments

Comments
 (0)