added functions to get program info filename (not used yet)
authorHolger Schemel <info@artsoft.org>
Tue, 29 Mar 2022 21:54:51 +0000 (23:54 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 29 Mar 2022 21:54:51 +0000 (23:54 +0200)
src/libgame/setup.c
src/libgame/setup.h
src/libgame/system.h

index ccbd2ed5ce6b36bd27db430584f8e2d31ccf78c7..b78d274ec05730dd4806701df0a8ce50813d68f9 100644 (file)
@@ -884,6 +884,34 @@ char *getCreditsFilename(int nr, boolean global)
   return NULL;         // cannot find credits file
 }
 
+static char *getProgramInfoBasename(int nr)
+{
+  static char basename[32];
+
+  sprintf(basename, "program_%d.txt", nr + 1);
+
+  return basename;
+}
+
+char *getProgramInfoFilename(int nr)
+{
+  char *basename = getProgramInfoBasename(nr);
+  static char *info_subdir = NULL;
+  static char *filename = NULL;
+
+  if (info_subdir == NULL)
+    info_subdir = getPath2(DOCS_DIRECTORY, INFO_DIRECTORY);
+
+  checked_free(filename);
+
+  // look for program info file in the game's base directory
+  filename = getPath3(options.base_directory, info_subdir, basename);
+  if (fileExists(filename))
+    return filename;
+
+  return NULL;         // cannot find program info file
+}
+
 static char *getCorrectedArtworkBasename(char *basename)
 {
   return basename;
index 69a9175e71c82b8b9bee8c7bc72929f99a871fe1..4b2e65f68885d9eef405a0e95441e5d9ee7b1504 100644 (file)
@@ -280,6 +280,7 @@ char *getHelpTextFilename(void);
 char *getLevelSetInfoFilename(void);
 char *getLevelSetTitleMessageFilename(int, boolean);
 char *getCreditsFilename(int, boolean);
+char *getProgramInfoFilename(int);
 char *getImageFilename(char *);
 char *getCustomImageFilename(char *);
 char *getCustomSoundFilename(char *);
index 8c79f19d692c9a85d6b255b6da3f5f3ffe78f8cd..7a80e91f0da848da91979a38e772a3ad50fe741d 100644 (file)
 #define DOCS_DIRECTORY         "docs"
 #define ELEMENTS_DIRECTORY     "elements"
 #define CREDITS_DIRECTORY      "credits"
+#define INFO_DIRECTORY         "info"
 #define CACHE_DIRECTORY                "cache"
 #define CONF_DIRECTORY         "conf"
 #define NETWORK_DIRECTORY      "network"