fixed bug with deriving game data directory from default 'setup.conf'
authorHolger Schemel <info@artsoft.org>
Wed, 14 Mar 2018 18:41:20 +0000 (19:41 +0100)
committerHolger Schemel <info@artsoft.org>
Fri, 23 Mar 2018 22:21:18 +0000 (23:21 +0100)
src/main.c

index 622b022c62e053da3ef298e2f676f031bda28d9f..75818dfc67d0fad777102152de3d377e7b2edbb0 100644 (file)
@@ -7688,10 +7688,14 @@ static void InitProgramConfig(char *command_filename)
   if (fileExists(config_filename))
   {
     // if program config file exists, derive Unix user data directory from it
-    userdata_basename = getBaseName(config_filename);
+    // (but only if the program config file is not generic "setup.conf" file)
+    if (!strEqual(getBaseNamePtr(config_filename), SETUP_FILENAME))
+    {
+      userdata_basename = getBaseName(config_filename);
 
-    if (strSuffix(userdata_basename, ".conf"))
-      userdata_basename[strlen(userdata_basename) - 5] = '\0';
+      if (strSuffix(userdata_basename, ".conf"))
+       userdata_basename[strlen(userdata_basename) - 5] = '\0';
+    }
 
     LoadSetupFromFilename(config_filename);
   }