Skip to content

Only use --path argument instead of --filename-in-archive and --directory-in-archive.#163

Merged
thomaslaurenson merged 1 commit into
thegraydot:mainfrom
sjoblomj:only-use-path-argument
Jun 4, 2026
Merged

Only use --path argument instead of --filename-in-archive and --directory-in-archive.#163
thomaslaurenson merged 1 commit into
thegraydot:mainfrom
sjoblomj:only-use-path-argument

Conversation

@sjoblomj

@sjoblomj sjoblomj commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

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 the add subcommand but not the create subcommand, 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:

  • Drop --filename-in-archive
  • Drop --directory-in-archive
  • Keep --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 --path argument now works for both the create and add subcommands.

@sjoblomj sjoblomj force-pushed the only-use-path-argument branch 3 times, most recently from a59feeb to 04e3a74 Compare June 3, 2026 19:36
@sjoblomj sjoblomj force-pushed the only-use-path-argument branch from 04e3a74 to 24473b4 Compare June 3, 2026 19:58

@thomaslaurenson thomaslaurenson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 💯 🥇

Comment thread src/commands.cpp

namespace fs = std::filesystem;

std::string ResolveArchiveName(const std::string &f, const std::optional<std::string> &path,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might move this to helpers.cpp later. Will have a closer look after merging - but not a big deal either way

@thomaslaurenson thomaslaurenson merged commit 7696fc2 into thegraydot:main Jun 4, 2026
12 checks passed
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.

2 participants