Check for enabled option & replace backward slashes with forward ones in mod save file paths.

This commit is contained in:
Skyth 2024-12-31 13:52:27 +03:00
parent cf7aae2d83
commit 9a50459085

View file

@ -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;
}