From: Holger Schemel Date: Tue, 7 Nov 2017 22:27:27 +0000 (+0100) Subject: added checking for default setup file in global config directory X-Git-Tag: 4.1.0.0~57 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=74cef390ce23b493089f414047426c73a1197e5f;p=rocksndiamonds.git added checking for default setup file in global config directory --- diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 73443b44..affc9365 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -472,19 +472,27 @@ char *getProgramConfigFilename(char *command_filename) if (strSuffix(command_filename_1, ".exe")) command_filename_1[strlen(command_filename_1) - 4] = '\0'; + char *ro_base_path = getProgramMainDataPath(command_filename, RO_BASE_PATH); + char *conf_directory = getPath2(ro_base_path, CONF_DIRECTORY); + char *command_basepath = getBasePath(command_filename); char *command_basename = getBaseNameNoSuffix(command_filename); char *command_filename_2 = getPath2(command_basepath, command_basename); char *config_filename_1 = getStringCat2(command_filename_1, ".conf"); char *config_filename_2 = getStringCat2(command_filename_2, ".conf"); + char *config_filename_3 = getPath2(conf_directory, SETUP_FILENAME); // 1st try: look for config file that exactly matches the binary filename if (fileExists(config_filename_1)) return config_filename_1; - // 2nd try: return config filename that matches binary filename without suffix - return config_filename_2; + // 2nd try: look for config file that matches binary filename without suffix + if (fileExists(config_filename_2)) + return config_filename_2; + + // 3rd try: return setup config filename in global program config directory + return config_filename_3; } char *getTapeFilename(int nr)