Add argument file to bypass Windows command length limits

What does the merge request do?

Adds support for an --arg-file argument that Inkscape uses as a workaround for the Windows command-line length limit. When a user runs an extension on a very large selection, the accumulated --id= and --selected-nodes= overflow that limit and Inkscape never launches the extension.

The companion change in Inkscape (inkscape!7899 (merged)) detects this case, puts them into a temp file, and passes a single --arg-file=<path> argument in their place. This MR gets inkex to expand that file back into the argument list before argparse runs.

Together with inkscape!7899 (merged), closes inkscape#2627 (closed).

Implementation notes

The expansion happens before argparse sees the arguments, so no new argument needs to be registered on the parser and no existing argument declarations change. The temp file is unlinked by inkex after reading. It remains backwarsd-compatible with older versions of Inkscape, since the --arg-file argument will never be encountered.

Summary for release notes

Fixed a bug where running an extension (e.g. one that operates on every selected object) on a very large selection of objects on Windows would silently fail to launch with an "Invalid argument" error. Extensions can now be run on selections of arbitrary size on all platforms.

Checklist

  • Add unit tests (not applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by David Burghoff

Merge request reports

Loading