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.
This commit is contained in:
Sude 2024-12-18 11:56:14 +02:00
parent 70a4437c3c
commit 2beaf26bed
4 changed files with 12 additions and 0 deletions

View File

@ -57,6 +57,7 @@ struct DownloadConfig
bool bDuplicateHandler;
bool bGalaxyDependencies;
bool bDeleteOrphans;
bool bGalaxyLowercasePath;
};
struct gameSpecificConfig

View File

@ -314,6 +314,7 @@ int main(int argc, char *argv[])
("subdir-galaxy-install", bpo::value<std::string>(&Globals::globalConfig.dirConf.sGalaxyInstallSubdir)->default_value("%install_dir%"), galaxy_install_subdir_text.c_str())
("galaxy-cdn-priority", bpo::value<std::string>(&sGalaxyCDN)->default_value("edgecast,akamai_edgecast_proxy,fastly"), galaxy_cdn_priority_text.c_str())
("galaxy-list-cdns", bpo::value<std::string>(&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<bool>(&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);

View File

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

View File

@ -312,6 +312,12 @@ std::vector<galaxyDepotItem> 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)
{