Skip to content

Commit 368a901

Browse files
authored
Add Unix timestamp to renamed corrupted file to prevent trying to copy over existing file. (#3984)
1 parent ed9cb1d commit 368a901

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

soh/soh/SaveManager.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,6 @@ void SaveManager::SaveGlobal() {
10241024
output << std::setw(4) << globalBlock << std::endl;
10251025
}
10261026

1027-
10281027
void SaveManager::LoadFile(int fileNum) {
10291028
SPDLOG_INFO("Load File - fileNum: {}", fileNum);
10301029
std::filesystem::path fileName = GetFileName(fileNum);
@@ -1077,7 +1076,7 @@ void SaveManager::LoadFile(int fileNum) {
10771076
GameInteractor::Instance->ExecuteHooks<GameInteractor::OnLoadFile>(fileNum);
10781077
} catch (const std::exception& e) {
10791078
input.close();
1080-
std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + ".bak"));
1079+
std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak"));
10811080
#if defined(__SWITCH__) || defined(__WIIU__)
10821081
copy_file(fileName.c_str(), newFile.c_str());
10831082
#else

0 commit comments

Comments
 (0)