From e23df0f09e9207044c777af492f2a2d891332975 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Thu, 20 Jan 2022 16:27:11 -0500 Subject: [PATCH] move config file to proper directory on macOS --- src/engine/engine.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index ddc991a4..521e8571 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -3447,6 +3447,16 @@ void DivEngine::quitDispatch() { isBusy.unlock(); } +#define CHECK_CONFIG_DIR_MAC() \ + configPath+="/Library/Application Support/Furnace"; \ + if (stat(configPath.c_str(),&st)<0) { \ + logI("creating config dir...\n"); \ + if (mkdir(configPath.c_str(),0755)<0) { \ + logW("could not make config dir! (%s)\n",strerror(errno)); \ + configPath="."; \ + } \ + } + #define CHECK_CONFIG_DIR() \ configPath+="/.config"; \ if (stat(configPath.c_str(),&st)<0) { \ @@ -3543,11 +3553,19 @@ bool DivEngine::init() { configPath="."; } else { configPath=entry->pw_dir; +#ifdef __APPLE__ + CHECK_CONFIG_DIR_MAC(); +#else CHECK_CONFIG_DIR(); +#endif } } else { configPath=home; +#ifdef __APPLE__ + CHECK_CONFIG_DIR_MAC(); +#else CHECK_CONFIG_DIR(); +#endif } #endif logD("config path: %s\n",configPath.c_str());