[−][src]Trait filepath::FilePath
An extension trait for std::fs::File
providing a path
method.
Required methods
fn path(&self) -> Result<PathBuf>
Returns the path of this file.
The path might be wrong for example after moving a file.
Platform-specific behavior
This function currently uses /proc/self/fd/
on Linux, fcntl
with F_GETPATH
on macOS
and GetFinalPathNameByHandle
on Windows.
Examples
use std::fs::File; use std::io; use filepath::FilePath; fn main() -> io::Result<()> { let file = File::open("some_file")?; let path = file.path()?; Ok(()) }