chwd 0.2.0

Temporarily change current working directory, switching back when finished.
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented1 out of 2 items with examples
  • Size
  • Source code size: 20.21 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.23 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • GrumpyMetalGuy/chwd
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • GrumpyMetalGuy

chwd 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