mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-01 21:42:31 +01:00
Add directory template %gamename_firstletter%
Feature request by "coffeecup" on GOG forums Useful for sorting big libraries with --subdir-game option Takes the first letter from %gamename% If %gamename% begins with a number then 0 (zero) is used instead
This commit is contained in:
parent
d307d22195
commit
4e09d6357e
2
main.cpp
2
main.cpp
@ -132,7 +132,7 @@ int main(int argc, char *argv[])
|
||||
std::string check_orphans_text = "Check for orphaned files (files found on local filesystem that are not found on GOG servers). Sets regular expression filter (Perl syntax) for files to check. If no argument is given then the regex defaults to '" + orphans_regex_default + "'";
|
||||
|
||||
// Help text for subdir options
|
||||
std::string subdir_help_text = "\nTemplates:\n- %platform%\n- %gamename%\n- %dlcname%";
|
||||
std::string subdir_help_text = "\nTemplates:\n- %platform%\n- %gamename%\n- %gamename_firstletter%\n- %dlcname%";
|
||||
|
||||
// Help text for include and exclude options
|
||||
std::string include_options_text;
|
||||
|
10
src/util.cpp
10
src/util.cpp
@ -410,6 +410,16 @@ void Util::filepathReplaceReservedStrings(std::string& str, const std::string& g
|
||||
platform = "no_platform";
|
||||
}
|
||||
|
||||
std::string gamename_firstletter;
|
||||
if (!gamename.empty())
|
||||
{
|
||||
if (std::isdigit(gamename.front()))
|
||||
gamename_firstletter = "0";
|
||||
else
|
||||
gamename_firstletter = gamename.front();
|
||||
}
|
||||
|
||||
while (Util::replaceString(str, "%gamename_firstletter%", gamename_firstletter));
|
||||
while (Util::replaceString(str, "%gamename%", gamename));
|
||||
while (Util::replaceString(str, "%dlcname%", dlcname));
|
||||
while (Util::replaceString(str, "%platform%", platform));
|
||||
|
Loading…
x
Reference in New Issue
Block a user