From 2beaf26bed0f0b7e11f529d182a7d76ffba23f6a Mon Sep 17 00:00:00 2001 From: Sude Date: Wed, 18 Dec 2024 11:56:14 +0200 Subject: [PATCH] Galaxy: Add option to convert file path to lowercase for Windows game files Some games for Windows have inconsistent casing for their file path. This option allows converting them to lowercase so we don't end up with multiple directories because capitalization makes them unique on case-sensitive filesystems. --- include/config.h | 1 + main.cpp | 1 + man/lgogdownloader.1 | 4 ++++ src/galaxyapi.cpp | 6 ++++++ 4 files changed, 12 insertions(+) diff --git a/include/config.h b/include/config.h index 84a7e38..e5583c1 100644 --- a/include/config.h +++ b/include/config.h @@ -57,6 +57,7 @@ struct DownloadConfig bool bDuplicateHandler; bool bGalaxyDependencies; bool bDeleteOrphans; + bool bGalaxyLowercasePath; }; struct gameSpecificConfig diff --git a/main.cpp b/main.cpp index aff0ef6..f76d151 100644 --- a/main.cpp +++ b/main.cpp @@ -314,6 +314,7 @@ int main(int argc, char *argv[]) ("subdir-galaxy-install", bpo::value(&Globals::globalConfig.dirConf.sGalaxyInstallSubdir)->default_value("%install_dir%"), galaxy_install_subdir_text.c_str()) ("galaxy-cdn-priority", bpo::value(&sGalaxyCDN)->default_value("edgecast,akamai_edgecast_proxy,fastly"), galaxy_cdn_priority_text.c_str()) ("galaxy-list-cdns", bpo::value(&galaxy_product_id_list_cdns)->default_value(""), "List available CDNs for game using product id [product_id/build_index] or gamename regex [gamename/build_id]\nBuild index is used to select a build and defaults to 0 if not specified.\n\nExample: 12345/2 selects build 2 for product 12345") + ("galaxy-lowercase-path", bpo::value(&Globals::globalConfig.dlConf.bGalaxyLowercasePath)->zero_tokens()->default_value(false), "Make filepath lowercase for Windows game files") ; options_cli_all.add(options_cli_no_cfg).add(options_cli_cfg).add(options_cli_experimental); diff --git a/man/lgogdownloader.1 b/man/lgogdownloader.1 index 8ec23eb..823ae65 100644 --- a/man/lgogdownloader.1 +++ b/man/lgogdownloader.1 @@ -581,6 +581,10 @@ Build (build index or build id) is used to select a build and defaults to 0 if n .br Example: 12345/2 selects build 2 for product 12345 .br +.TP +\fB\-\-galaxy\-lowercase\-path\fR arg +Make filepath lowercase for Windows game files +.br .SH LANGUAGES Languages available to select with \fB\-\-language\fR and \fB\-\-galaxy\-language\fR options .br diff --git a/src/galaxyapi.cpp b/src/galaxyapi.cpp index b38e90e..36ca0b2 100644 --- a/src/galaxyapi.cpp +++ b/src/galaxyapi.cpp @@ -312,6 +312,12 @@ std::vector galaxyAPI::getDepotItemsVector(const std::string& h item.sfc_size = json["depot"]["items"][i]["sfcRef"]["size"].asLargestUInt(); } + if (Globals::globalConfig.dlConf.bGalaxyLowercasePath && + Globals::globalConfig.dlConf.iGalaxyPlatform == GlobalConstants::PLATFORM_WINDOWS) + { + boost::algorithm::to_lower(item.path); + } + while (Util::replaceString(item.path, "\\", "/")); for (unsigned int j = 0; j < json["depot"]["items"][i]["chunks"].size(); ++j) {