Update System.cpp

This commit is contained in:
Elad Ashkenazi 2022-10-24 15:48:28 +03:00 committed by kd-11
parent 880a4e3ca6
commit 90d6069a16

View file

@ -677,17 +677,17 @@ game_boot_result Emulator::BootGame(const std::string& path, const std::string&
continue; continue;
} }
old_path = old_path.substr(0, old_path.find_last_not_of(fs::delim) + 1); std::string new_path = old_path.substr(0, old_path.find_last_not_of(fs::delim) + 1);
const usz insert_pos = old_path.find_last_of(fs::delim) + 1; const usz insert_pos = new_path.find_last_of(fs::delim) + 1;
const auto prefix = "used_"sv; const auto prefix = "used_"sv;
if (old_path.compare(insert_pos, prefix.size(), prefix) != 0) if (new_path.compare(insert_pos, prefix.size(), prefix) != 0)
{ {
old_path.insert(insert_pos, prefix); new_path.insert(insert_pos, prefix);
if (fs::rename(path, old_path, true)) if (fs::rename(old_path, new_path, true))
{ {
sys_log.notice("Savestate has been moved to path='%s'", old_path); sys_log.notice("Savestate has been moved to path='%s'", new_path);
} }
} }
} }