From 9a50459085fadf4ba09faba2dcf97d1f3b4e3b92 Mon Sep 17 00:00:00 2001 From: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Tue, 31 Dec 2024 13:52:27 +0300 Subject: [PATCH] Check for enabled option & replace backward slashes with forward ones in mod save file paths. --- UnleashedRecomp/mod/mod_loader.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/UnleashedRecomp/mod/mod_loader.cpp b/UnleashedRecomp/mod/mod_loader.cpp index f85428ed..a39069aa 100644 --- a/UnleashedRecomp/mod/mod_loader.cpp +++ b/UnleashedRecomp/mod/mod_loader.cpp @@ -93,9 +93,12 @@ void ModLoader::Init() if (!configIni.read("cpkredir.ini")) return; + if (!configIni.getBool("CPKREDIR", "Enabled", true)) + return; + if (configIni.getBool("CPKREDIR", "EnableSaveFileRedirection", false)) { - std::string saveFilePathU8 = configIni.getString("CPKREDIR", "SaveFileFallback", std::string()); + std::string saveFilePathU8 = configIni.getString("CPKREDIR", "SaveFileFallback", ""); if (!saveFilePathU8.empty()) ModLoader::s_saveFilePath = std::u8string_view((const char8_t*)saveFilePathU8.c_str()); else @@ -181,6 +184,7 @@ void ModLoader::Init() if (!modSaveFilePathU8.empty()) { + std::replace(modSaveFilePathU8.begin(), modSaveFilePathU8.end(), '\\', '/'); ModLoader::s_saveFilePath = modDirectoryPath / std::u8string_view((const char8_t*)modSaveFilePathU8.c_str()); foundModSaveFilePath = true; }