Only use --path argument instead of --filename-in-archive and --directory-in-archive.#163
Merged
Conversation
a59feeb to
04e3a74
Compare
04e3a74 to
24473b4
Compare
thomaslaurenson
approved these changes
Jun 4, 2026
thomaslaurenson
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR @sjoblomj - always appreciate the help. I know how you feel. After I wrote up the PR and merged it, I was not very happy with it. The only thing I was actually happy with was the performance gain when using add. I think this PR simplifies a lot of un-needed complexity.
I noted that I might move a function from the commands.cpp file later. But apart from that everything looks good. Will just make this a pre-release and bundle it up for a release soon.
Thanks again for the contribution 💯 🥇
|
|
||
| namespace fs = std::filesystem; | ||
|
|
||
| std::string ResolveArchiveName(const std::string &f, const std::optional<std::string> &path, |
Collaborator
There was a problem hiding this comment.
I might move this to helpers.cpp later. Will have a closer look after merging - but not a big deal either way
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I realize there's already been discussions on this subject, but I can't help myself but revisit this.
There's currently three arguments to control how files should be named in the MPQs:
--path,--filename-in-archive, and--directory-in-archive. They are partially overlapping, can't always be used together, and some are only applicable to theaddsubcommand but not thecreatesubcommand, even though those two subcommands essentially serve the same purpose (puts files in an archive). Furthermore, the current implementation is buggy and inconsistent as it stands today.I figured this needed some more attention. My idea in this PR is the following:
--filename-in-archive--directory-in-archive--path. When adding a single file, this argument sets both the directory and the filename, and when adding a directory (or multiple files), it sets the directory only. This is - I hope - well documented now.The
--pathargument now works for both thecreateandaddsubcommands.