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

Optimze ProcessStartInfo arguments handling #616

Merged
merged 2 commits into from
Apr 27, 2023
Merged

Optimze ProcessStartInfo arguments handling #616

merged 2 commits into from
Apr 27, 2023

Conversation

fishjimi
Copy link
Contributor

@fishjimi fishjimi commented Apr 27, 2023

ZipExtractor project FormMain.cs is using API Environment.GetCommandLineArgs() to get arguments.
According to MSDN https://learn.microsoft.com/en-us/dotnet/api/system.environment.getcommandlineargs. this API is very strictly on handling of backslashes and double quotation marks.
If our app is under some root directory such as d:\
We are supposed to get args --output "d:\" in ZipExtractor, but it actrully geting --output d:", obviously this is not a valid path #608 .
This is a hidden danger of concatenating arguments to a string.
ProcessStartInfo class has a property ArgumentList, which can handle argument separation automaticlly. we will no more struggling with spaces, backslashes, and quotation marks.

image

@ravibpatel
Copy link
Owner

Thanks for the pull request. I was working on it, but didn't know about the ArgumentList. Your solution is much better.

@ravibpatel ravibpatel merged commit 68af9fc into ravibpatel:master Apr 27, 2023
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