From c0ca361da652205227795d1a7673f73a9bf48b44 Mon Sep 17 00:00:00 2001 From: Julie Marchant Date: Mon, 27 May 2019 00:28:04 -0400 Subject: [PATCH] Added proper Windows support. I think this should be good, but I can't test it right now because I don't have a Windows compiler handy at the moment. Will make sure to do so before making a release. --- src/engine.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/engine.c b/src/engine.c index f993e89..4523dc9 100644 --- a/src/engine.c +++ b/src/engine.c @@ -22,7 +22,9 @@ along with this program. If not, see . #include #include -#ifndef _WIN32 +#ifdef _WIN32 +#include +#else #include #endif @@ -197,10 +199,11 @@ void engine_setupConfigDirectory() char dir[PATH_MAX]; #ifdef _WIN32 - // XXX: This is a bad design, but I just can't be bothered to learn - // the Windows API so I can do this properly. If anyone wants to - // make this point to the proper directory, be my guest! - userHome = "."; + if (SHGetKnownFolderPath(FOLDERID_LocalAppData, KF_FLAG_CREATE, NULL, &userHome) != S_OK) + { + userHome = "."; + engine_warn("Could not get appdata location; using the current working directory instead."); + } #else if ((userHome = getenv("HOME")) == NULL) userHome = getpwuid(getuid())->pw_dir;