hello all,
i am trying to create a temporary directory like so:
let uuid = Uuid::new_v4().to_string();
let tmpdirname = TempDir::new(&uuid);
fs::create_dir(tmpdirname);
// copy files to temporary folder
for file in WalkDir::new("/tmp") {
// TODO:
}
however, this returns the error:
error[E0277]: the trait bound `Result<TempDir, std::io::Error>: AsRef<Path>` is not satisfied
--> src/main.rs:30:32
|
30 | fs::create_dir(tmpdirname);
| -------------- ^^^^^^^^^^ the trait `AsRef<Path>` is not implemented for `Result<TempDir, std::io::Error>`
| |
| required by a bound introduced by this call
|
note: required by a bound in `create_dir`
As i am stilllearning rust, this doesnt make much sense to me. neither does the rustc --explaination that it shows me. i got this from a tutorial so i assume this is correct?
in the end i am trying to create a temporary directory, copy files and folders to it, execute a batch script that builds an msi, and then return this msi