From 09636da4bae80775e0e611b196ed0d2128ba82dd Mon Sep 17 00:00:00 2001 From: shenweip Date: Mon, 18 Nov 2013 23:42:38 +0800 Subject: [PATCH 1/2] Ignore the difference between "\" and "/" in "recent" and "remove from recent". --- Core/Config.cpp | 2 +- UI/GameScreen.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Config.cpp b/Core/Config.cpp index d1898f27bb..aa88ca9be1 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -554,7 +554,7 @@ void Config::Save() { void Config::AddRecent(const std::string &file) { for (auto str = recentIsos.begin(); str != recentIsos.end(); str++) { - if (*str == file) { + if (!strcmpIgnore(*str, file, "\\", "/")) { recentIsos.erase(str); recentIsos.insert(recentIsos.begin(), file); if ((int)recentIsos.size() > iMaxRecent) diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index ff88db4917..ea9fb2483c 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -211,7 +211,7 @@ UI::EventReturn GameScreen::OnCreateShortcut(UI::EventParams &e) { bool GameScreen::isRecentGame(std::string gamePath) { for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) { - if (!strcmp((*it).c_str(),gamePath.c_str())) + if (!strcmpIgnore((*it).c_str(), gamePath_.c_str(), "\\","/")) return true; } return false; @@ -219,7 +219,7 @@ bool GameScreen::isRecentGame(std::string gamePath) { UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) { for (auto it = g_Config.recentIsos.begin(); it != g_Config.recentIsos.end(); ++it) { - if (!strcmp((*it).c_str(),gamePath_.c_str())) { + if (!strcmpIgnore((*it).c_str(), gamePath_.c_str(), "\\","/")) { g_Config.recentIsos.erase(it); screenManager()->switchScreen(new MainScreen()); return UI::EVENT_DONE; From 7bd0e0de782c3534d7835d84a9d505263cfc7eba Mon Sep 17 00:00:00 2001 From: shenweip Date: Tue, 19 Nov 2013 20:46:33 +0800 Subject: [PATCH 2/2] Only do this for windows. --- Core/Config.cpp | 4 ++++ UI/GameScreen.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/Core/Config.cpp b/Core/Config.cpp index aa88ca9be1..0af1f6ff94 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -554,7 +554,11 @@ void Config::Save() { void Config::AddRecent(const std::string &file) { for (auto str = recentIsos.begin(); str != recentIsos.end(); str++) { +#ifdef _WIN32 if (!strcmpIgnore(*str, file, "\\", "/")) { +#else + if (!strcmp(*str, file)) { +#endif recentIsos.erase(str); recentIsos.insert(recentIsos.begin(), file); if ((int)recentIsos.size() > iMaxRecent) diff --git a/UI/GameScreen.cpp b/UI/GameScreen.cpp index ea9fb2483c..6a509a25e6 100644 --- a/UI/GameScreen.cpp +++ b/UI/GameScreen.cpp @@ -211,7 +211,11 @@ UI::EventReturn GameScreen::OnCreateShortcut(UI::EventParams &e) { bool GameScreen::isRecentGame(std::string 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_)) +#endif return true; } return false; @@ -219,7 +223,11 @@ bool GameScreen::isRecentGame(std::string gamePath) { UI::EventReturn GameScreen::OnRemoveFromRecent(UI::EventParams &e) { 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_)) { +#endif g_Config.recentIsos.erase(it); screenManager()->switchScreen(new MainScreen()); return UI::EVENT_DONE;