Fixing issue with command line parameter --startingDirectory #19419
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Fixing issue with command line parameter --startingDirectory ending in a wrong path because of the way CommandLineToArgvW do its parse.
References and Relevant Issues
https://devblogs.microsoft.com/oldnewthing/20100917-00/?p=12833
Detailed Description of the Pull Request / Additional comments
In this command line example:
--startingDirectory "C:\Users\My User\"
the CommandLineToArgvW method parses the path excluding the opening quote and maintaining the ending quote, because it is backed by a trailing slash.I've done a very specific fix to only fix that usage of that parameter, so it doesn't end in any regression.
Validation Steps Performed
Used to fail setting the starting directory (note the trailing backslash):
wt.exe --startingDirectory "c:\A\B B\"
Successfully sets the starting directory:
wt.exe --startingDirectory "c:\A\B B"
PR Checklist