diff --git a/rpcs3/Gui/GameViewer.cpp b/rpcs3/Gui/GameViewer.cpp index ec57471e93..6250c99508 100644 --- a/rpcs3/Gui/GameViewer.cpp +++ b/rpcs3/Gui/GameViewer.cpp @@ -70,11 +70,12 @@ void GameViewer::InitPopupMenu() m_popup->Append(1, _T("Configure")); m_popup->Append(2, _T("Remove Game")); m_popup->Append(3, _T("Remove Custom Configuration")); - + m_popup->Append(4, _T("Open Game Folder")); Bind(wxEVT_MENU, &GameViewer::BootGame, this, 0); Bind(wxEVT_MENU, &GameViewer::ConfigureGame, this, 1); Bind(wxEVT_MENU, &GameViewer::RemoveGame, this, 2); Bind(wxEVT_MENU, &GameViewer::RemoveGameConfig, this, 3); + Bind(wxEVT_MENU, &GameViewer::OpenGameFolder, this, 4); } void GameViewer::DoResize(wxSize size) @@ -259,6 +260,31 @@ void GameViewer::RemoveGameConfig(wxCommandEvent& event) Refresh(); } +void GameViewer::OpenGameFolder(wxCommandEvent& event) +{ + long i = GetFirstSelected(); + if (i < 0) return; + + const std::string& spath = Emu.GetGameDir() + m_game_data[i].root; + +#ifdef _WIN32 + std::string command = "explorer " + spath; + std::string oldc("/"), newc("\\"); + size_t pos = 0; + while ((pos = command.find(oldc, pos)) != std::string::npos) { + command.replace(pos, oldc.length(), newc); + pos += newc.length(); + } + wxExecute(fmt::FromUTF8(command)); +#elif __APPLE__ + std::string command = "open " + spath; + wxExecute(fmt::FromUTF8(command)); +#elif __Linux + std::string command = "xdg-open " + spath; + wxExecute(fmt::FromUTF8(command)); +#endif +} + ColumnsArr::ColumnsArr() { Init(); diff --git a/rpcs3/Gui/GameViewer.h b/rpcs3/Gui/GameViewer.h index 3fdd7a6e0b..23e4af48ab 100644 --- a/rpcs3/Gui/GameViewer.h +++ b/rpcs3/Gui/GameViewer.h @@ -88,6 +88,7 @@ public: void ConfigureGame(wxCommandEvent& event); void RemoveGame(wxCommandEvent& event); void RemoveGameConfig(wxCommandEvent& event); + void OpenGameFolder(wxCommandEvent & event); private: virtual void DClick(wxListEvent& event);