diff --git a/apps/mwiniimporter/main.cpp b/apps/mwiniimporter/main.cpp index 4bab5d8c03..1d4b6b588e 100644 --- a/apps/mwiniimporter/main.cpp +++ b/apps/mwiniimporter/main.cpp @@ -52,7 +52,8 @@ private: int wmain(int argc, wchar_t *wargv[]) { utf8argv converter(argc, wargv); char **argv = converter.get(); - std::filesystem::path::imbue(boost::locale::generator().generate("")); + // TODO(Project579): Temporarly disabled until a good solution is found (no solution might actually be needed) + //std::filesystem::path::imbue(boost::locale::generator().generate("")); #endif try diff --git a/apps/openmw_test_suite/openmw/options.cpp b/apps/openmw_test_suite/openmw/options.cpp index 33c38da5df..dacf9c81f3 100644 --- a/apps/openmw_test_suite/openmw/options.cpp +++ b/apps/openmw_test_suite/openmw/options.cpp @@ -33,7 +33,7 @@ namespace std::vector result; (result.emplace_back(makeString(args)) , ...); for (int i = 1; i <= std::numeric_limits::max(); ++i) - if (i != '&' && i != '"' && i != ' ' && i != '\n') + if (i != '\\' && i != '"' && i != ' ' && i != '\n') result.push_back(std::string(1, i)); return result; } @@ -127,22 +127,22 @@ namespace EXPECT_EQ(variables["load-savegame"].as().string(), R"(save)"); } - TEST(OpenMWOptionsFromArguments, should_support_quoted_load_savegame_path_with_escaped_quote_by_ampersand) + TEST(OpenMWOptionsFromArguments, should_support_quoted_load_savegame_path_with_escaped_quote) { bpo::options_description description = makeOptionsDescription(); - const std::array arguments {"openmw", "--load-savegame", R"("save&".omwsave")"}; + const std::array arguments {"openmw", "--load-savegame", R"("save\".omwsave")"}; bpo::variables_map variables; parseArgs(arguments, variables, description); EXPECT_EQ(variables["load-savegame"].as().string(), R"(save".omwsave)"); } - TEST(OpenMWOptionsFromArguments, should_support_quoted_load_savegame_path_with_escaped_ampersand) + TEST(OpenMWOptionsFromArguments, should_support_quoted_load_savegame_path_with_escaped_backslash) { bpo::options_description description = makeOptionsDescription(); - const std::array arguments {"openmw", "--load-savegame", R"("save.omwsave&&")"}; + const std::array arguments {"openmw", "--load-savegame", R"("save.omwsave\\")"}; bpo::variables_map variables; parseArgs(arguments, variables, description); - EXPECT_EQ(variables["load-savegame"].as().string(), "save.omwsave&"); + EXPECT_EQ(variables["load-savegame"].as().string(), R"(save.omwsave\)"); } TEST(OpenMWOptionsFromArguments, should_support_load_savegame_path_with_ampersand) @@ -274,7 +274,7 @@ namespace TEST(OpenMWOptionsFromConfig, should_support_confusing_savegame_path_with_lots_going_on) { bpo::options_description description = makeOptionsDescription(); - std::istringstream stream(R"(load-savegame="one &"two"three".omwsave")"); + std::istringstream stream(R"(load-savegame="one \"two"three".omwsave")"); bpo::variables_map variables; Files::parseConfig(stream, variables, description); EXPECT_EQ(variables["load-savegame"].as().string(), R"(one "two)"); @@ -283,7 +283,7 @@ namespace TEST(OpenMWOptionsFromConfig, should_support_confusing_savegame_path_with_even_more_going_on) { bpo::options_description description = makeOptionsDescription(); - std::istringstream stream(R"(load-savegame="one &"two"three ".omwsave")"); + std::istringstream stream(R"(load-savegame="one \"two"three ".omwsave")"); bpo::variables_map variables; Files::parseConfig(stream, variables, description); EXPECT_EQ(variables["load-savegame"].as().string(), R"(one "two)"); @@ -351,22 +351,22 @@ namespace EXPECT_THAT(variables["data"].as(), ElementsAre(IsPath("1"), IsPath("2"))); } - TEST(OpenMWOptionsFromConfig, should_support_quoted_load_savegame_path_with_escaped_quote_by_ampersand) + TEST(OpenMWOptionsFromConfig, should_support_quoted_load_savegame_path_with_escaped_quote) { bpo::options_description description = makeOptionsDescription(); - std::istringstream stream(R"(load-savegame="save&".omwsave")"); + std::istringstream stream(R"(load-savegame="save\".omwsave")"); bpo::variables_map variables; Files::parseConfig(stream, variables, description); EXPECT_EQ(variables["load-savegame"].as().string(), R"(save".omwsave)"); } - TEST(OpenMWOptionsFromConfig, should_support_quoted_load_savegame_path_with_escaped_ampersand) + TEST(OpenMWOptionsFromConfig, should_support_quoted_load_savegame_path_with_escaped_backslash) { bpo::options_description description = makeOptionsDescription(); - std::istringstream stream(R"(load-savegame="save.omwsave&&")"); + std::istringstream stream(R"(load-savegame="save.omwsave\\")"); bpo::variables_map variables; Files::parseConfig(stream, variables, description); - EXPECT_EQ(variables["load-savegame"].as().string(), "save.omwsave&"); + EXPECT_EQ(variables["load-savegame"].as().string(), R"(save.omwsave\)"); } TEST(OpenMWOptionsFromConfig, should_support_load_savegame_path_with_ampersand) diff --git a/components/files/windowspath.cpp b/components/files/windowspath.cpp index 1daf77a1e5..1222c2e5cb 100644 --- a/components/files/windowspath.cpp +++ b/components/files/windowspath.cpp @@ -40,7 +40,8 @@ WindowsPath::WindowsPath(const std::string& application_name) See std::filesystem and boost::locale reference for details. */ - std::filesystem::path::imbue(boost::locale::generator().generate("")); + // TODO(Project579): Temporarly disabled until a good solution is found (no solution might actually be needed) + //std::filesystem::path::imbue(boost::locale::generator().generate("")); std::filesystem::path localPath = getLocalPath(); if (!SetCurrentDirectoryA(localPath.string().c_str())) @@ -91,7 +92,7 @@ std::filesystem::path WindowsPath::getLocalPath() const if (GetModuleFileNameW(nullptr, path, MAX_PATH + 1) > 0) { - localPath = std::filesystem::path(bconv::utf_to_utf(path)).parent_path() / "/"; + localPath = std::filesystem::path(bconv::utf_to_utf(path)).parent_path().string() + "/"; } // lookup exe path