Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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.

2 participants