1 unstable release
0.1.0 | Mar 21, 2022 |
---|
#1388 in Filesystem
27KB
481 lines
Create temporary directory and file.
- No dependencies.
- Create in any directory.
- Add prefix and suffix in the name.
- Auto deletion.
use maketemp::TempDir;
use std::path::Path;
fn main() {
let p;
{
// create temporary directory.
let dir = TempDir::open();
p = dir.path().to_string();
// true.
println!("path {} exists: {} ",&p,Path::new(&p).exists());
// delete `dir` automatically here.
}
// false.
println!("path: {} exists: {}",&p,Path::new(&p).exists());
}