UI: Resolve symlinks when adding things to recent.

See #11131.  This also normalizes paths, captialization, etc. as
necessary.
This commit is contained in:
Unknown W. Brackets 2018-08-12 08:24:33 -07:00
parent 1fdb1f785a
commit 048afb6d24
7 changed files with 52 additions and 38 deletions

View file

@ -354,31 +354,18 @@ bool GameScreen::isRecentGame(const std::string &gamePath) {
if (g_Config.iMaxRecent <= 0)
return false;
const std::string resolved = File::ResolvePath(gamePath);
for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) {
#ifdef _WIN32
if (!strcmpIgnore((*it).c_str(), gamePath.c_str(), "\\","/"))
#else
if (!strcmp((*it).c_str(), gamePath.c_str()))
#endif
const std::string recent = File::ResolvePath(*it);
if (resolved == recent)
return true;
}
return false;
}
UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) {
if (g_Config.iMaxRecent <= 0)
return UI::EVENT_DONE;
for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) {
#ifdef _WIN32
if (!strcmpIgnore((*it).c_str(), gamePath_.c_str(), "\\","/")) {
#else
if (!strcmp((*it).c_str(), gamePath_.c_str())) {
#endif
g_Config.recentIsos.erase(it);
screenManager()->switchScreen(new MainScreen());
return UI::EVENT_DONE;
}
}
g_Config.RemoveRecent(gamePath_);
screenManager()->switchScreen(new MainScreen());
return UI::EVENT_DONE;
}