diff options
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/config.c b/src/config.c index ebaff3e..02889b0 100644 --- a/src/config.c +++ b/src/config.c @@ -7,12 +7,6 @@ #include "config.h" #include "common.h" -#ifdef _WIN32 -#define HOMEVAR "USERPROFILE" -#else -#define HOMEVAR "HOME" -#endif - static void getXDGDir(const char* envvar, const char* homeext, char* config, const size_t size) { char* xdg_var = getenv(envvar); @@ -23,8 +17,16 @@ static void getXDGDir(const char* envvar, const char* homeext, char* config, con } else { - char* home = getenv(HOMEVAR); + char* home = getenv("HOME"); if (!home) home = ""; + if (!home) + { +#ifdef _WIN32 + home = getenv("USERPROFILE"); + if (!home) +#endif + home = ""; + } strncpy(config, home, size); strncat(config, homeext, size - strlen(config)); } |