1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 05:31:22 +00:00
nixpkgs/pkgs/games/gimx/env.patch
2021-02-01 12:28:48 +03:00

31 lines
1.1 KiB
Diff

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