diff options
| author | Malkierian <malkierian@gmail.com> | 2024-02-28 20:46:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-28 22:46:32 -0500 |
| commit | 368a9015ac3610f68d9ddd4d18ac0d7573788581 (patch) | |
| tree | c490f90a61e9768c041520cf659b4f8fb1b38865 | |
| parent | ed9cb1dfd257712dda6fc304b361f2c862321788 (diff) | |
Add Unix timestamp to renamed corrupted file to prevent trying to copy over existing file. (#3984)
| -rw-r--r-- | soh/soh/SaveManager.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 10d40396f..d8003988f 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -1024,7 +1024,6 @@ void SaveManager::SaveGlobal() { output << std::setw(4) << globalBlock << std::endl; } - void SaveManager::LoadFile(int fileNum) { SPDLOG_INFO("Load File - fileNum: {}", fileNum); std::filesystem::path fileName = GetFileName(fileNum); @@ -1077,7 +1076,7 @@ void SaveManager::LoadFile(int fileNum) { GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum); } catch (const std::exception& e) { input.close(); - std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + ".bak")); + std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak")); #if defined(__SWITCH__) || defined(__WIIU__) copy_file(fileName.c_str(), newFile.c_str()); #else |
