Skip to content

huwper/with_dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

with_dir

Blazingly fast utility library for temporarily changing the current working directory.

This library provides the following features:

  1. Convenient scoped changing of directories
  2. Global Reentrant mutex to prevent concurrent instances of WithDir from conflicting.

The mutex allows this to be safely used across multhreaded tests, where each test will be entering different directories as no two WithDir instances can exist on different threads. However nested instances on the same thread can exist.

use with_dir::WithDir;
use std::path::Path;

let path = Path::new("src");

// enter that directory
WithDir::new(path).map(|_| {
    // Current working directory is now src
}).unwrap();
// cwd is reset

Contributing

Contributions welcome.

FAQ

Is it good?

yes.

License

See LICENSE

About

rust utility for temporarily changing directory

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages