Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileOptions should be mappable #12

Closed
m4heshd opened this issue Apr 8, 2024 · 5 comments · Fixed by #13 or #14
Closed

FileOptions should be mappable #12

m4heshd opened this issue Apr 8, 2024 · 5 comments · Fixed by #13 or #14
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@m4heshd
Copy link
Contributor

m4heshd commented Apr 8, 2024

First of all, thank you so much for this awesome extension.

I'm currently having trouble setting permissions to just a few of the files I'm adding to an archive.

What if the functionality were to be like this?

    let mut zip = ZipWriter::new(file);

    zip.create_from_directory_with_options(&PathBuf::from(&source_dir), |file: &PathBuf| {
        if file.eq(&PathBuf::from("dir/my_executable")) {
            FileOptions::default().unix_permissions(0o775)
        } else {
            FileOptions::default()
        }
    })

This allows changing the FileOptions per item inside the source directory. The file argument in the closure can be entry_path from the directory_entry_iterator.

I'd love to implement this but it would obviously be a breaking change. There's also the option of dedicating a whole new function for this. 🤔

@m4heshd
Copy link
Contributor Author

m4heshd commented Apr 9, 2024

Just implemented this in m4heshd@4096c01. I'll be using that for the moment. If you think it's worth a merge, I'll go ahead and create a PR.

@matzefriedrich
Copy link
Owner

matzefriedrich commented Apr 9, 2024 via email

@m4heshd
Copy link
Contributor Author

m4heshd commented Apr 9, 2024

Hey Matthias,

Glad I got a quick response from you. I'll initiate a PR as soon as possible. I'll be of help as much as I'm able to, for this feature to go live.

@matzefriedrich
Copy link
Owner

matzefriedrich commented May 31, 2024

@m4heshd I merged your PR into the development branch in preparation for a new release.

@m4heshd
Copy link
Contributor Author

m4heshd commented May 31, 2024

@matzefriedrich That's wonderful news. Can't wait for the feature to go live.

@matzefriedrich matzefriedrich linked a pull request May 31, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
2 participants