Creating temporary directory doesnt work

hello all,

i am trying to create a temporary directory like so:

                let uuid = Uuid::new_v4().to_string();
                let tmpdirname = TempDir::new(&uuid);
                    // 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/
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 :slight_smile:

create_dir returns a Result, you have to handle it in some way before using it.

And tempdir already creates the directory


thank you :slight_smile: that info got me further :slight_smile: