Skip to content

Commit

Permalink
When adding filenames to recent list, convert slashes to /. See #9335
Browse files Browse the repository at this point in the history
Note that this doesn't fix existing backslashes but solves it in the
long run.
  • Loading branch information
hrydgard committed Feb 21, 2017
1 parent 06cf449 commit 31dd8fd
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Core/Config.cpp
Expand Up @@ -1110,20 +1110,26 @@ void Config::AddRecent(const std::string &file) {
if (iMaxRecent <= 0)
return;

#ifdef _WIN32
std::string filename = ReplaceAll(file, "\\", "/");
#else
std::string filename = file;
#endif

for (auto str = recentIsos.begin(); str != recentIsos.end(); ++str) {
#ifdef _WIN32
if (!strcmpIgnore((*str).c_str(), file.c_str(), "\\", "/")) {
if (!strcmpIgnore((*str).c_str(), filename.c_str(), "\\", "/")) {
#else
if (!strcmp((*str).c_str(), file.c_str())) {
if (!strcmp((*str).c_str(), filename.c_str())) {
#endif
recentIsos.erase(str);
recentIsos.insert(recentIsos.begin(), file);
recentIsos.insert(recentIsos.begin(), filename);
if ((int)recentIsos.size() > iMaxRecent)
recentIsos.resize(iMaxRecent);
return;
}
}
recentIsos.insert(recentIsos.begin(), file);
recentIsos.insert(recentIsos.begin(), filename);
if ((int)recentIsos.size() > iMaxRecent)
recentIsos.resize(iMaxRecent);
}
Expand Down

0 comments on commit 31dd8fd

Please sign in to comment.