summary refs log tree commit diff
path: root/pkgs/games/gimx/env.patch
blob: e1f8ed8bb6f1434d68ac305eae5a899740191285 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- a/core/config_reader.c
+++ b/core/config_reader.c
@@ -1353,8 +1353,10 @@ static int read_file(char* file_path)
 int read_config_file(const char* file)
 {
   char file_path[PATH_MAX];
-
-  snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, file);
+  char* e = getenv("GIMXCONF"); if (e) { snprintf(file_path, sizeof(file_path), "%s/%s", e, file); }
+  else {
+    snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, file);
+  }
 
   if(read_file(file_path) == -1)
   {
--- a/core/gimx.c
+++ b/core/gimx.c
@@ -190,8 +190,10 @@ void show_config()
   }
 
   char file_path[PATH_MAX];
-
-  snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, gimx_params.config_file);
+  char* e = getenv("GIMXCONF"); if (e) { snprintf(file_path, sizeof(file_path), "%s/%s", e, gimx_params.config_file); }
+  else {
+    snprintf(file_path, sizeof(file_path), "%s%s%s%s", gimx_params.homedir, GIMX_DIR, CONFIG_DIR, gimx_params.config_file);
+  }
 
   FILE * fp = gfile_fopen(file_path, "r");
   if (fp == NULL)