depot/third_party/nixpkgs/pkgs/games/gimx/env.patch

31 lines
1.1 KiB
Diff
Raw Normal View History

--- 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)