diff --git a/src/api/game/load_order_handler.cpp b/src/api/game/load_order_handler.cpp index 8d484837..03a62b29 100644 --- a/src/api/game/load_order_handler.cpp +++ b/src/api/game/load_order_handler.cpp @@ -65,7 +65,7 @@ void LoadOrderHandler::Init(const GameType& gameType, } const char* gameLocalDataPath = nullptr; - string tempPathString = gameLocalAppData.string(); + string tempPathString = gameLocalAppData.u8string(); if (!tempPathString.empty()) gameLocalDataPath = tempPathString.c_str(); @@ -76,7 +76,7 @@ void LoadOrderHandler::Init(const GameType& gameType, } int ret = lo_create_handle( - &gh_, mapGameId(gameType), gamePath.string().c_str(), gameLocalDataPath); + &gh_, mapGameId(gameType), gamePath.u8string().c_str(), gameLocalDataPath); HandleError("create a game handle", ret); } diff --git a/src/api/helpers/git_helper.cpp b/src/api/helpers/git_helper.cpp index 1e0524a7..c29d72f0 100644 --- a/src/api/helpers/git_helper.cpp +++ b/src/api/helpers/git_helper.cpp @@ -114,7 +114,7 @@ void GitHelper::Open(const std::filesystem::path& repoRoot) { logger_->info("Attempting to open Git repository at: {}", repoRoot.string()); } - Call(git_repository_open(&data_.repo, repoRoot.string().c_str())); + Call(git_repository_open(&data_.repo, repoRoot.u8string().c_str())); } void GitHelper::SetRemoteUrl(const std::string& remote, @@ -150,7 +150,7 @@ void GitHelper::Call(int error_code) { bool GitHelper::IsRepository(const std::filesystem::path& path) { return git_repository_open_ext(NULL, - path.string().c_str(), + path.u8string().c_str(), GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) == 0; } @@ -208,7 +208,7 @@ void GitHelper::Clone(const std::filesystem::path& path, // Perform the clone. Call(git_clone(&data_.repo, url.c_str(), - repoPath.string().c_str(), + repoPath.u8string().c_str(), &data_.clone_options)); // If repo was cloned into a temporary directory, move it into the target @@ -591,7 +591,7 @@ bool GitHelper::IsFileDifferent(const std::filesystem::path& repoRoot, logger->trace("Existing repository found, attempting to open it."); } GitHelper git; - git.Call(git_repository_open(&git.data_.repo, repoRoot.string().c_str())); + git.Call(git_repository_open(&git.data_.repo, repoRoot.u8string().c_str())); // Perform a git diff, then iterate the deltas to see if one exists for the // masterlist. diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index 98d33bdd..ea8c8218 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -58,9 +58,9 @@ Plugin::Plugin(const GameType gameType, std::filesystem::path filepath = dataPath / name_; // In case the plugin is ghosted. - if (!std::filesystem::exists(filepath) && - std::filesystem::exists(filepath.string() + ".ghost")) + if (!std::filesystem::exists(filepath)) { filepath += ".ghost"; + } Load(filepath, gameType, headerOnly); @@ -241,7 +241,7 @@ bool Plugin::IsValid(const std::string& filename, bool isValid; auto path = dataPath / filename; int ret = esp_plugin_is_valid( - GetEspluginGameId(gameType), path.string().c_str(), true, &isValid); + GetEspluginGameId(gameType), path.u8string().c_str(), true, &isValid); if (ret != ESP_OK || !isValid) { if (logger) { @@ -274,7 +274,7 @@ void Plugin::Load(const std::filesystem::path& path, bool headerOnly) { ::Plugin* plugin; int ret = esp_plugin_new( - &plugin, GetEspluginGameId(gameType), path.string().c_str()); + &plugin, GetEspluginGameId(gameType), path.u8string().c_str()); if (ret != ESP_OK) { throw FileAccessError(path.string() + " : esplugin error code: " + std::to_string(ret)); diff --git a/src/tests/common_game_test_fixture.h b/src/tests/common_game_test_fixture.h index 4345e1ac..91b0ef33 100644 --- a/src/tests/common_game_test_fixture.h +++ b/src/tests/common_game_test_fixture.h @@ -43,11 +43,11 @@ namespace loot { namespace test { std::filesystem::path getRootTestPath() { - auto directoryName = "LOOT-" + boost::lexical_cast( + auto directoryName = u8"LOOT-t\u00E9st-" + boost::lexical_cast( (boost::uuids::random_generator())()); return std::filesystem::absolute(std::filesystem::temp_directory_path() / - directoryName); + std::filesystem::u8path(directoryName)); } class CommonGameTestFixture : public ::testing::TestWithParam {