aboutsummaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-05-08 23:24:08 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-05-08 23:24:08 +0200
commit6cc1ec3610ba98bada1fcd03a654b2925530f748 (patch)
treed772a02517cc8022100be2a89f8e4000559066ba /src/config.c
parent14e8bfdc0a83a1256f2efc92868ead7dbd26bc51 (diff)
downloadpolecat-6cc1ec3610ba98bada1fcd03a654b2925530f748.tar.gz
polecat-6cc1ec3610ba98bada1fcd03a654b2925530f748.zip
add work in progress windows support
to run lutris installers on windows soon
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index 85aaf40..ac2f82b 100644
--- a/src/config.c
+++ b/src/config.c
@@ -8,6 +8,12 @@
#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);
@@ -18,7 +24,8 @@ static void getXDGDir(const char* envvar, const char* homeext, char* config, con
}
else
{
- char* home = getenv("HOME");
+ char* home = getenv(HOMEVAR);
+ if (!home) home = "";
strncpy(config, home, size);
strncat(config, homeext, size - strlen(config));
}