diff --git a/main.cpp b/main.cpp index c951c03..0df9004 100644 --- a/main.cpp +++ b/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; diff --git a/src/util.cpp b/src/util.cpp index fefb937..7650b21 100644 --- a/src/util.cpp +++ b/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));