diff --git a/src/openrct2/Game.cpp b/src/openrct2/Game.cpp index 45208988c0..d6023d21b2 100644 --- a/src/openrct2/Game.cpp +++ b/src/openrct2/Game.cpp @@ -686,16 +686,17 @@ static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processL size_t autosavesCount = 0; size_t numAutosavesToDelete = 0; - char const* folderDirectory = "save"; + auto environment = GetContext()->GetPlatformEnvironment(); + auto folderDirectory = environment->GetDirectoryPath(DIRBASE::USER, DIRID::SAVE); char const* fileFilter = "autosave_*.sv6"; if (processLandscapeFolder) { - folderDirectory = "landscape"; + folderDirectory = environment->GetDirectoryPath(DIRBASE::USER, DIRID::LANDSCAPE); fileFilter = "autosave_*.sc6"; } utf8 filter[MAX_PATH]; - safe_strcpy(filter, folderDirectory, sizeof(filter)); + safe_strcpy(filter, folderDirectory.c_str(), sizeof(filter)); safe_strcat_path(filter, "autosave", sizeof(filter)); safe_strcat_path(filter, fileFilter, sizeof(filter)); @@ -722,7 +723,7 @@ static void limit_autosave_count(const size_t numberOfFilesToKeep, bool processL autosaveFiles[i].resize(MAX_PATH, 0); if (scanner->Next()) { - platform_get_user_directory(autosaveFiles[i].data(), folderDirectory, sizeof(utf8) * MAX_PATH); + platform_get_user_directory(autosaveFiles[i].data(), folderDirectory.c_str(), sizeof(utf8) * MAX_PATH); safe_strcat_path(autosaveFiles[i].data(), "autosave", sizeof(utf8) * MAX_PATH); safe_strcat_path(autosaveFiles[i].data(), scanner->GetPathRelative(), sizeof(utf8) * MAX_PATH); }