Hide the file name resolution behind the interface

This commit is contained in:
Henrik Rydgård committed 2025-03-26 17:31:47 +01:00
1 parent a156697822
commit ca64734bcd
3 files changed
+20 -16

No files matched your search

+2 -4
View File
@@ -1578,8 +1578,7 @@ void Config::AddRecent(const std::string &filename) {
return;
// We'll add it back below. This makes sure it's at the front, and only once.
const std::string resolvedFilename = File::ResolvePath(filename);
AddRecentResolved(resolvedFilename, iMaxRecent);
::AddRecent(filename, iMaxRecent);
}
void Config::RemoveRecent(const std::string &filename) {
@@ -1587,8 +1586,7 @@ void Config::RemoveRecent(const std::string &filename) {
return;
}
std::string resolvedFilename = File::ResolvePath(filename);
RemoveRecentResolved(resolvedFilename);
::RemoveRecent(filename);
}
// On iOS, the path to the app documents directory changes on each launch.
+16 -10
View File
@@ -77,16 +77,6 @@ void SaveRecentIsos(Section *recent, int maxRecent) {
}
}
void AddRecentResolved(const std::string &resolvedFilename, int maxRecent) {
RemoveRecentResolved(resolvedFilename);
ResetRecentIsosThread();
std::lock_guard<std::mutex> guard(recentIsosLock);
recentIsos.insert(recentIsos.begin(), resolvedFilename);
if ((int)recentIsos.size() > maxRecent)
recentIsos.resize(maxRecent);
}
void RemoveRecentResolved(const std::string &resolvedFilename) {
ResetRecentIsosThread();
@@ -99,6 +89,22 @@ void RemoveRecentResolved(const std::string &resolvedFilename) {
recentIsos.erase(iter, recentIsos.end());
}
void AddRecent(const std::string &filename, int maxRecent) {
std::string resolvedFilename = File::ResolvePath(filename);
RemoveRecentResolved(resolvedFilename);
ResetRecentIsosThread();
std::lock_guard<std::mutex> guard(recentIsosLock);
recentIsos.insert(recentIsos.begin(), resolvedFilename);
if ((int)recentIsos.size() > maxRecent)
recentIsos.resize(maxRecent);
}
void RemoveRecent(const std::string &filename) {
std::string resolvedFilename = File::ResolvePath(filename);
RemoveRecentResolved(resolvedFilename);
}
void CleanRecentIsos() {
SetRecentIsosThread([] {
SetCurrentThreadName("RecentISOs");
+2 -2
View File
@@ -10,8 +10,8 @@ void ResetRecentIsosThread();
void SetRecentIsosThread(std::function<void()> f);
void LoadRecentIsos(const Section *recent, int maxRecent);
void SaveRecentIsos(Section *recent, int maxRecent);
void AddRecentResolved(const std::string &resolvedFilename, int maxRecent);
void RemoveRecentResolved(const std::string &resolvedFilename);
void AddRecent(const std::string &resolvedFilename, int maxRecent);
void RemoveRecent(const std::string &resolvedFilename);
void CleanRecentIsos();
std::vector<std::string> GetRecentIsos();
bool HasRecentIsos();