-
Notifications
You must be signed in to change notification settings - Fork 743
Fix opening of save directory on macOS #1546
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
Conversation
src/gui/components/wxGameList.cpp
Outdated
| // escape any spaces in file path | ||
| std::string saveFolder = boost::replace_all_copy(_pathToUtf8(gameInfo.GetSaveFolder()), " ", "%20"); | ||
| wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", saveFolder))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // escape any spaces in file path | |
| std::string saveFolder = boost::replace_all_copy(_pathToUtf8(gameInfo.GetSaveFolder()), " ", "%20"); | |
| wxLaunchDefaultBrowser(wxHelper::FromUtf8(fmt::format("file:{}", saveFolder))); | |
| // handles any spaces in file path | |
| wxLaunchDefaultApplication(wxHelper::FromPath(gameInfo.GetSaveFolder())); |
Confirmed that this also works. Perhaps it should be preferred as it does not require any additional string editing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably best to use wxHelper::FromPath, as it can then handle any special characters in the string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
Thanks for this - it's been a longstanding minor annoyance :) |
Open directories through default file handler rather than file URI scheme
|
Opening directories from the title manager also saw this issue so I updated that in the latest commit, as well as the for the game, update, and DLC directories, as trying to open them would also lead to errors if the directory paths included any spaces. |
|
Thanks! |
On macOS, trying to open save directory locations through the context menu usually results in errors like:
This is due to the default MLC path on macOS being located at
~/Library/Application\ Support/Cemu/mlc01, which contains a space. I tried escaping with a\or surrounding the path with"", but it appears that sincewxLaunchDefaultBrowseris being used then URI encoding is required.I couldn't find a URI encoding function in either<wx/uri.h>or<wx/url.h>, so I just did a manual string replacement of all spaces.Alternatively,it's possible to just usewxLaunchDefaultApplicationinstead like this:Cemu/src/gui/MainWindow.cpp
Lines 683 to 684 in b089ae5
I have not tested this on Linux or Windows, though this change doesn't seem like it would break anything in either