Skip to content

Rust library to temporarily change your cwd, then switch it back when you're done.

License

Notifications You must be signed in to change notification settings

GrumpyMetalGuy/chwd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chwd Build Status Documentation

Rust library to temporarily change your cwd, then switch it back when you're done.

Usage

Call ChangeWorkingDirectory's change function to change the current working directory, assigning the result to a local temporary variable. Once this variable goes out of scope, the current working directory will change back to the directory that was in use at the time of object creation.

fn main()
{
    {
        let _dir_change = ChangeWorkingDirectory::change(&env::temp_dir())?;
        // Do something in the temp dir
    }

    // _dir_change has gone out of scope, you will be back where you started.
}

Contributions

Although this is a fairly simple library, if you can think of anything that could be done to improve it, please open an issue or submit a PR!

License

This project is licensed under

About

Rust library to temporarily change your cwd, then switch it back when you're done.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages