Fix "Show in folder" on windows when path has spaces #3641
Merged
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.
On windows, "Show in folder" opens the default (Documents) folder when someone with the default ("User 1") profile uses it on an image residing in the media folder
In this case, a typical media path would be
C:\Users\name with spaces\AppData\Roaming\Anki2\User 1\collection.media\img.png
However,
But adding quotes around
path
, i.e.breaks it for all paths, even those without spaces. I suspect the issue is improper command line quoting with the extra "s
As per microsoft/WSL#7603 (comment) and this SO answer, spliting off the path into its own arg lets it be quoted properly
NB:
is an alternative, because the above-mentioned limitation doesn't apply to the shell, which correctly handles it regardless of spaces for some reason 😕