Trait filepath::FilePath[][src]

pub trait FilePath {
    fn path(&self) -> Result<PathBuf>;
}

An extension trait for std::fs::File providing a path method.

Required Methods

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(())
}

Implementations on Foreign Types

impl FilePath for File
[src]

Implementors