diff --git a/src/api/api.cpp b/src/api/api.cpp index f217b231..5a9384d9 100644 --- a/src/api/api.cpp +++ b/src/api/api.cpp @@ -73,18 +73,18 @@ LOOT_API std::shared_ptr CreateGameHandle( logger->info( "Attempting to create a game handle with game path \"{}\" " "and local path \"{}\"", - gamePath.string(), - gameLocalPath.string()); + gamePath.u8string(), + gameLocalPath.u8string()); } auto resolvedGamePath = ResolvePath(gamePath); if (!fs::is_directory(resolvedGamePath)) - throw std::invalid_argument("Given game path \"" + gamePath.string() + + throw std::invalid_argument("Given game path \"" + gamePath.u8string() + "\" does not resolve to a valid directory."); auto resolvedGameLocalPath = ResolvePath(gameLocalPath); if (!gameLocalPath.empty() && !fs::is_directory(resolvedGameLocalPath)) - throw std::invalid_argument("Given game local path \"" + gameLocalPath.string() + + throw std::invalid_argument("Given game local path \"" + gameLocalPath.u8string() + "\" does not resolve to a valid directory."); return std::make_shared(game, resolvedGamePath, resolvedGameLocalPath); diff --git a/src/api/api_database.cpp b/src/api/api_database.cpp index 63424a62..5f39114d 100644 --- a/src/api/api_database.cpp +++ b/src/api/api_database.cpp @@ -56,7 +56,7 @@ void ApiDatabase::LoadLists(const std::filesystem::path& masterlistPath, temp.Load(masterlistPath); } else { throw FileAccessError("The given masterlist path does not exist: " + - masterlistPath.string()); + masterlistPath.u8string()); } } @@ -65,7 +65,7 @@ void ApiDatabase::LoadLists(const std::filesystem::path& masterlistPath, userTemp.Load(userlistPath); } else { throw FileAccessError("The given userlist path does not exist: " + - userlistPath.string()); + userlistPath.u8string()); } } @@ -93,7 +93,7 @@ bool ApiDatabase::UpdateMasterlist(const std::filesystem::path& masterlistPath, const std::string& remoteURL, const std::string& remoteBranch) { if (!std::filesystem::is_directory(masterlistPath.parent_path())) - throw std::invalid_argument("Given masterlist path \"" + masterlistPath.string() + + throw std::invalid_argument("Given masterlist path \"" + masterlistPath.u8string() + "\" does not have a valid parent directory."); Masterlist masterlist; diff --git a/src/api/game/game.cpp b/src/api/game/game.cpp index 391e703e..bd33a6c4 100644 --- a/src/api/game/game.cpp +++ b/src/api/game/game.cpp @@ -65,7 +65,7 @@ Game::Game(const GameType gameType, if (logger) { logger->info("Initialising load order data for game of type {} at: {}", (int)type_, - gamePath_.string()); + gamePath_.u8string()); } loadOrderHandler_->Init(type_, gamePath_, localDataPath); diff --git a/src/api/helpers/crc.cpp b/src/api/helpers/crc.cpp index 7af5361d..c596267a 100644 --- a/src/api/helpers/crc.cpp +++ b/src/api/helpers/crc.cpp @@ -51,7 +51,7 @@ uint32_t GetCrc32(const std::filesystem::path& filename) { try { auto logger = getLogger(); if (logger) { - logger->trace("Calculating CRC for: {}", filename.string()); + logger->trace("Calculating CRC for: {}", filename.u8string()); } std::ifstream ifile(filename, std::ios::binary); @@ -73,12 +73,12 @@ uint32_t GetCrc32(const std::filesystem::path& filename) { uint32_t checksum = result.checksum(); if (logger) { - logger->debug("CRC32(\"{}\"): {:x}", filename.string(), checksum); + logger->debug("CRC32(\"{}\"): {:x}", filename.u8string(), checksum); } return checksum; } catch (std::exception& e) { - throw FileAccessError("Unable to open \"" + filename.string() + + throw FileAccessError("Unable to open \"" + filename.u8string() + "\" for CRC calulation: " + e.what()); } } diff --git a/src/api/helpers/git_helper.cpp b/src/api/helpers/git_helper.cpp index c29d72f0..01329e9e 100644 --- a/src/api/helpers/git_helper.cpp +++ b/src/api/helpers/git_helper.cpp @@ -112,7 +112,7 @@ void GitHelper::InitialiseOptions(const std::string& branch, void GitHelper::Open(const std::filesystem::path& repoRoot) { if (logger_) { logger_->info("Attempting to open Git repository at: {}", - repoRoot.string()); + repoRoot.u8string()); } Call(git_repository_open(&data_.repo, repoRoot.u8string().c_str())); } diff --git a/src/api/masterlist.cpp b/src/api/masterlist.cpp index 08a3aa89..07a8876e 100644 --- a/src/api/masterlist.cpp +++ b/src/api/masterlist.cpp @@ -48,12 +48,12 @@ MasterlistInfo Masterlist::GetInfo(const std::filesystem::path& path, logger->info("Unknown masterlist revision: No masterlist present."); } throw FileAccessError(string("N/A: No masterlist present at ") + - path.string()); + path.u8string()); } else if (!git.IsRepository(path.parent_path())) { if (logger) { logger->info("Unknown masterlist revision: Git repository missing."); } - throw GitStateError(string("Unknown: \"") + path.parent_path().string() + + throw GitStateError(string("Unknown: \"") + path.parent_path().u8string() + "\" is not a Git repository."); } @@ -84,7 +84,7 @@ bool Masterlist::IsLatest(const std::filesystem::path& path, logger->info( "Cannot get latest masterlist revision: Git repository missing."); } - throw GitStateError(string("Unknown: \"") + path.parent_path().string() + + throw GitStateError(string("Unknown: \"") + path.parent_path().u8string() + "\" is not a Git repository."); } @@ -115,7 +115,7 @@ bool Masterlist::Update(const std::filesystem::path& path, // Now try to access the repository if it exists, or clone one if it doesn't. if (logger) { - logger->trace("Checking for Git repository at: {}", repoPath.string()); + logger->trace("Checking for Git repository at: {}", repoPath.u8string()); } if (!GitHelper::IsRepository(repoPath)) { git.Clone(repoPath, repoUrl); diff --git a/src/api/metadata/condition_evaluator.cpp b/src/api/metadata/condition_evaluator.cpp index 30abf344..0c6c5748 100644 --- a/src/api/metadata/condition_evaluator.cpp +++ b/src/api/metadata/condition_evaluator.cpp @@ -264,7 +264,7 @@ bool ConditionEvaluator::compareVersions(const std::string& filePath, void ConditionEvaluator::validatePath(const std::filesystem::path& path) { auto logger = getLogger(); if (logger) { - logger->trace("Checking to see if the path \"{}\" is safe.", path.string()); + logger->trace("Checking to see if the path \"{}\" is safe.", path.u8string()); } std::filesystem::path temp; @@ -273,7 +273,7 @@ void ConditionEvaluator::validatePath(const std::filesystem::path& path) { continue; if (component == ".." && temp.filename() == "..") { - throw ConditionSyntaxError("Invalid file path: " + path.string()); + throw ConditionSyntaxError("Invalid file path: " + path.u8string()); } temp /= component; @@ -350,7 +350,7 @@ bool ConditionEvaluator::isRegexMatchInDataDirectory( auto logger = getLogger(); if (logger) { logger->trace("The path \"{}\" is not a game subdirectory.", - pathRegex.first.string()); + pathRegex.first.u8string()); } return false; } diff --git a/src/api/metadata_list.cpp b/src/api/metadata_list.cpp index 1a95ef1c..e2bdfdac 100644 --- a/src/api/metadata_list.cpp +++ b/src/api/metadata_list.cpp @@ -40,18 +40,18 @@ void MetadataList::Load(const std::filesystem::path& filepath) { auto logger = getLogger(); if (logger) { - logger->debug("Loading file: {}", filepath.string()); + logger->debug("Loading file: {}", filepath.u8string()); } std::ifstream in(filepath); if (!in.good()) - throw FileAccessError("Cannot open " + filepath.string()); + throw FileAccessError("Cannot open " + filepath.u8string()); YAML::Node metadataList = YAML::Load(in); in.close(); if (!metadataList.IsMap()) - throw FileAccessError("The root of the metadata file " + filepath.string() + + throw FileAccessError("The root of the metadata file " + filepath.u8string() + " is not a YAML map."); if (metadataList["plugins"]) { @@ -83,7 +83,7 @@ void MetadataList::Load(const std::filesystem::path& filepath) { void MetadataList::Save(const std::filesystem::path& filepath) const { auto logger = getLogger(); if (logger) { - logger->trace("Saving metadata list to: {}", filepath.string()); + logger->trace("Saving metadata list to: {}", filepath.u8string()); } YAML::Emitter emitter; emitter.SetIndent(2); diff --git a/src/api/plugin.cpp b/src/api/plugin.cpp index ea8c8218..c3e78260 100644 --- a/src/api/plugin.cpp +++ b/src/api/plugin.cpp @@ -276,7 +276,7 @@ void Plugin::Load(const std::filesystem::path& path, int ret = esp_plugin_new( &plugin, GetEspluginGameId(gameType), path.u8string().c_str()); if (ret != ESP_OK) { - throw FileAccessError(path.string() + + throw FileAccessError(path.u8string() + " : esplugin error code: " + std::to_string(ret)); } @@ -285,7 +285,7 @@ void Plugin::Load(const std::filesystem::path& path, ret = esp_plugin_parse(esPlugin.get(), headerOnly); if (ret != ESP_OK) { - throw FileAccessError(path.string() + + throw FileAccessError(path.u8string() + " : esplugin error code: " + std::to_string(ret)); } }