Method lrs::file::File::current_dir

Creates a file that points to the current working directory.

Syntax

impl File {
    fn current_dir() -> File
}

Return value

Returns a file that points to the current working directory.

Remarks

This call does not actually open a directory. The returned File is thus affected by changes of the global current working directory via lrs::process::set_cwd . If you require a pointer to the current directory that is not affected by changes to the current working directory of the process, use the following code:

let file = try!(File::open(".", FILE_PATH);

This call is mostly useful when working with interfaces that require an argument which points to a directory. For example, File::open is implemented like this:

pub fn open_read<P>(path: P) -> Result<File>
    where P: ToCString,
{
    File::current_dir().rel_open_read(path)
}

See also