Skip to content

2.3.0: ZipArchive::extract newly expects the destination dir exists #314

@marxin

Description

@marxin

Describe the bug
The following code snippet stopped working with update to 2.3.0 if the directory does not exist:

 let path = r"C:\Users\martinlika\Downloads\sample.zip";
    ZipArchive::new(File::open(path).unwrap())
        .unwrap()
        .extract(r"C:\Users\martinlika\Downloads\folder_xyz")
        .unwrap();

Fails with:

     Running `target\debug\zip-demo.exe`
thread 'main' panicked at src\main.rs:10:10:
called `Result::unwrap()` on an `Err` value: Io(Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\zip-demo.exe` (exit code: 101)

Looking at the documentation of the function, there is no requirement mentioned about the existence of the directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions