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

Post-Processing Script Parameters #4363

Merged
merged 1 commit into from
Apr 5, 2018
Merged

Post-Processing Script Parameters #4363

merged 1 commit into from
Apr 5, 2018

Conversation

TheThirdOne
Copy link
Contributor

@TheThirdOne TheThirdOne commented Apr 3, 2018

This is a solution to #4000.

I didn't realize this before I finished, but #4325 also solves the issue (it did remind me that \ is a poor escaping character for windows). However, that solution prevents ! from being using in any of the arguments or executable name. This one instead splits on whitespace and allows escaping whitespace so it doesn't prevent any filename from being expressed.

Examples:
/path/to/executable becomes /path/to/executable with the arg outputfilename.gcode

/path/to/executable -arg -arg2 becomes /path/to/executable with args -arg, -arg2, and outputfilename.gcode

/path/to/executable! with! spaces -arg -arg2 becomes /path/to/executable with spaces with args -arg, -arg2, and outputfilename.gcode

/path/to/executable!! -arg -arg2 becomes /path/to/executable! with args -arg, -arg2, and outputfilename.gcode

The escaping is solved robustly so it should work exactly as programmers would expect (but with ! instead of \ because of Windows). But non programmers may not find it as obvious and people with existing post processing scripts that have whitespace in them may be surprised by their script breaking.

I haven't testing on Windows, but I don't see why it shouldn't work.

Any whitespace is the boundrary between the args/filename. Whitespace can be
escaped by putting a exxclamation point in front of it. And exclamation points
can be escaped by putting an exclamation point in front of the exclamation point
to be escaped.

I thought about adding another box for arguments, but I think that would make it
more confusing to use. The only worry I have with this method is peoples existing
scripts with whitespace in the name.
@foreachthing
Copy link
Member

Just as well! :-)
Q: May I have spaces in args? Like -full path to output file...

@TheThirdOne
Copy link
Contributor Author

Yeah that works just fine.

/path/to/executable option! with! spaces becomes /path/to/executable with args option with spaces and outputfilename.gcode

@lordofhyphens
Copy link
Member

I will take a look at it tonight and make any recommendations as necessary. Thanks for the PR.

@foreachthing
Copy link
Member

Downloaded the "artifacts" from here: https://ci.appveyor.com/project/lordofhyphens/slic3r/build/1.3.0-master-1639/ and tested with Windows 7 x64 => works.

@lordofhyphens: as far as I'm concerned, you can close #4325 and merge this PR.

@lordofhyphens
Copy link
Member

About the only thing I could want would be a regression test (to make sure that if someone manages to break it again the future we notice immediately).

@lordofhyphens
Copy link
Member

Yeah, looks pretty good. Thank you @TheThirdOne .

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.

3 participants