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

dir/extract: add mode for overwriting existing files #65

Closed
wants to merge 1 commit into from

Conversation

tmplt
Copy link
Contributor

@tmplt tmplt commented Oct 27, 2021

A dir::ExtractMode enum is added with the options Overwrite and FailIfExists. The latter is the current behavior. The former truncates any already existing files.

@Michael-F-Bryan
Copy link
Owner

If people do want their files to be overwritten, can't they just call std::fs::remove_dir_all() first?

@tmplt
Copy link
Contributor Author

tmplt commented Nov 3, 2021 via email

@tmplt
Copy link
Contributor Author

tmplt commented Nov 30, 2021

Will this be merged if conflicts are fixed?

@Michael-F-Bryan
Copy link
Owner

I'm going to close this PR for now.

My thinking is that:

  • The Dir::extract() method is a convenience function which will work for 90% of use cases
  • The implementation is a trivial recursive function that you can write yourself
  • Adding extra arguments and types means now everyone will need to be choose how naming collisions are handled and add an extra use include_dir::ExtractMode, even though they aren't concerned about this use case
  • If people want to customise the extraction process they should be able to implement their own.

See also Project Goals and Values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants