Add trivial "Show in Folder" functionality to game screen

This commit is contained in:
Henrik Rydgard 2013-12-11 20:19:30 +01:00
parent cf0f4b612e
commit 13dd5f305c
2 changed files with 13 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include "gfx_es2/draw_buffer.h"
#include "i18n/i18n.h"
#include "math/curves.h"
#include "util/text/utf8.h"
#include "ui/ui_context.h"
#include "ui/view.h"
#include "ui/viewgroup.h"
@ -77,6 +78,9 @@ void GameScreen::CreateViews() {
if (isRecentGame(gamePath_)) {
rightColumnItems->Add(new Choice(ga->T("Remove From Recent")))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
}
#ifdef _WIN32
rightColumnItems->Add(new Choice(ga->T("Show In Folder")))->OnClick.Handle(this, &GameScreen::OnShowInFolder);
#endif
UI::SetFocusedView(play);
}
@ -149,6 +153,14 @@ void GameScreen::update(InputState &input) {
}
}
UI::EventReturn GameScreen::OnShowInFolder(UI::EventParams &e) {
#ifdef _WIN32
std::string str = std::string("explorer.exe /select,\"") + ReplaceAll(gamePath_, "/", "\\") + "\"";
_wsystem(ConvertUTF8ToWString(str).c_str());
#endif
return UI::EVENT_DONE;
}
UI::EventReturn GameScreen::OnSwitchBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK);
return UI::EVENT_DONE;