diff --git a/Qt/QtMain.cpp b/Qt/QtMain.cpp index 9ed900f1e7..17d1b58de6 100644 --- a/Qt/QtMain.cpp +++ b/Qt/QtMain.cpp @@ -5,6 +5,7 @@ // Qt 4.7+ / 5.0+ implementation of the framework. // Currently supports: Android, Linux, Windows, Mac OSX +#include "ppsspp_config.h" #include #include #include @@ -41,6 +42,7 @@ #include "Common/Data/Text/I18n.h" #include "Common/Thread/ThreadUtil.h" #include "Common/Data/Encoding/Utf8.h" +#include "Common/StringUtils.h" #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/HW/Camera.h" @@ -282,7 +284,7 @@ void Vibrate(int length_ms) { } void OpenDirectory(const char *path) { - // Unsupported + QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(path))); } void LaunchBrowser(const char *url) diff --git a/SDL/SDLMain.cpp b/SDL/SDLMain.cpp index f0f74f979a..b6bdd25ad1 100644 --- a/SDL/SDLMain.cpp +++ b/SDL/SDLMain.cpp @@ -190,12 +190,18 @@ void System_AskForPermission(SystemPermission permission) {} PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; } void OpenDirectory(const char *path) { -#if defined(_WIN32) - PIDLIST_ABSOLUTE pidl = ILCreateFromPath(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str()); +#if PPSSPP_PLATFORM(WINDOWS) + SFGAOF flags; + PIDLIST_ABSOLUTE pidl = nullptr; + HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str(), nullptr, &pidl, 0, &flags); if (pidl) { - SHOpenFolderAndSelectItems(pidl, 0, NULL, 0); - ILFree(pidl); + if (SUCCEEDED(hr)) + SHOpenFolderAndSelectItems(pidl, 0, NULL, 0); + CoTaskMemFree(pidl); } +#elif PPSSPP_PLATFORM(MAC) + std::string command = std::string("open ") + path; + system(command.c_str()); #endif } diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index 9cb05ca450..2749fa98b3 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -168,7 +168,7 @@ void GameScreen::CreateViews() { if (isRecentGame(gamePath_)) { rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Remove From Recent"))))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent); } -#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) +#if (defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)) && !PPSSPP_PLATFORM(UWP) rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Show In Folder"))))->OnClick.Handle(this, &GameScreen::OnShowInFolder); #endif if (g_Config.bEnableCheats) { diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index c062d5d3f7..021d0dedb3 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -894,6 +894,10 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new ItemHeader(sy->T("PSP Memory Stick"))); +#if (defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)) && !PPSSPP_PLATFORM(UWP) + systemSettings->Add(new Choice(sy->T("Show Memory Stick folder")))->OnClick.Handle(this, &GameSettingsScreen::OnOpenMemStick); +#endif + #if PPSSPP_PLATFORM(ANDROID) memstickDisplay_ = g_Config.memStickDirectory.ToVisualString(); auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), (const char *)nullptr)); @@ -1167,6 +1171,11 @@ UI::EventReturn GameSettingsScreen::OnChangeMemStickDir(UI::EventParams &e) { return UI::EVENT_DONE; } +UI::EventReturn GameSettingsScreen::OnOpenMemStick(UI::EventParams &e) { + OpenDirectory(File::ResolvePath(g_Config.memStickDirectory.ToString().c_str()).c_str()); + return UI::EVENT_DONE; +} + #if defined(_WIN32) && !PPSSPP_PLATFORM(UWP) UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) { diff --git a/UI/GameSettingsScreen.h b/UI/GameSettingsScreen.h index f4c590a355..ec7fc73a81 100644 --- a/UI/GameSettingsScreen.h +++ b/UI/GameSettingsScreen.h @@ -117,6 +117,7 @@ private: UI::EventReturn OnAudioDevice(UI::EventParams &e); UI::EventReturn OnJitAffectingSetting(UI::EventParams &e); UI::EventReturn OnChangeMemStickDir(UI::EventParams &e); + UI::EventReturn OnOpenMemStick(UI::EventParams &e); #if defined(_WIN32) && !PPSSPP_PLATFORM(UWP) UI::EventReturn OnSavePathMydoc(UI::EventParams &e); UI::EventReturn OnSavePathOther(UI::EventParams &e); diff --git a/Windows/main.cpp b/Windows/main.cpp index de84517444..59ee239d7d 100644 --- a/Windows/main.cpp +++ b/Windows/main.cpp @@ -108,10 +108,14 @@ static std::thread inputBoxThread; static bool inputBoxRunning = false; void OpenDirectory(const char *path) { - PIDLIST_ABSOLUTE pidl = ILCreateFromPath(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str()); + SFGAOF flags; + PIDLIST_ABSOLUTE pidl = nullptr; + HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str(), nullptr, &pidl, 0, &flags); + if (pidl) { - SHOpenFolderAndSelectItems(pidl, 0, NULL, 0); - ILFree(pidl); + if (SUCCEEDED(hr)) + SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0); + CoTaskMemFree(pidl); } }