33319 - Make PlatformInteractive.RevealInFileBrowser properly invoke Windows Explorer to select the file#13
Merged
igorkorsukov merged 1 commit intoMay 12, 2026
Conversation
igorkorsukov
approved these changes
May 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
First PR to resolve MuseScore/33319. Then a second PR will be created to update the submodule.
The problem here is that
PlatformInteractive::RevealInFileBrowseris passing explorer /select,filename as the program to start specifying no command line arguments.QProcessperforms some proccessing of the program string: namely, on Windows it replaces any forward slashes "/" with backslashes "\". So the program to start ends up being explorer \select,filename. Note: the forward slash beforeselectbecomes a backslash and as a result Windows explorer does not recognize it and does not select the file (but properly opens the containing folder).Therefore the solution at first glance is to pass only explorer as the program to start and pass /select,filename as a command line argument (the second parameter to
QProcess::startDetached).There is another hidden problem - that
filenamemust be enclosed in double quotes so that paths and file names with spaces (and possibly other special characters) be processed correctly (as part of the filename and not as other command line prameters). This leads to another problem:QProcessalso processes the command-line parameters and if a parameter contains a double quote, it add a backslash ("\") before the quote and encloses the entire parameter in double quotes. So the argument /select,"filename" is turned into "/select,\"filename\"" which again is not what Windows Explorer expects.The solution is to pass /select,"filename" in
nativeArguments.nativeArgumentsis aQProcessproperty containing command-line arguments thatQProcessjust appends unprocessed to the other arguments (that it pre-processes). The use ofnativeArgumentsrequires that we create aQProcessinstance - the native arguments cannot be set in any static method ofQProcess.Summary of changes:
QProcess::startDetachedcan no longer be used because the argument must be passed via thenativeArgumentsproperty (so the argument is not altered in any way).QProcess class documentation