From 3caa92c5674fa9040c3fdbfc0dca1ef2517ee033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Mon, 2 Jan 2023 15:38:29 +0800 Subject: [PATCH] macOS: looking for config files in `~/Library/Preferences` --- CHANGELOG.md | 5 +++-- src/common/init.c | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a92bd6b5..680134cd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ Notable Changes: Features: * `--logo-padding-top` option (@CarterLi, #372) * Raw image file as logo support (@CarterLi) -* Look for config files in $LOCALAPPDATA (Windows) (@CarterLi) +* Look for config files in `$LOCALAPPDATA` (Windows) +* Look for config files in `~/Library/Preferences` (macOS) Logos: * Raspbian (@IamNoRobot, #373) @@ -16,7 +17,7 @@ Bugfixes: Other: * Fixed a Typo in iterm error message (@jessebot, #376) -* Don't try to load config file in `/etc` (Windows) (@jessebot, #376) +* Don't try to load config file in `/etc` (Windows) # 1.8.2 diff --git a/src/common/init.c b/src/common/init.c index 8522c0cd9..b571bf753 100644 --- a/src/common/init.c +++ b/src/common/init.c @@ -37,7 +37,15 @@ static void initConfigDirs(FFstate* state) CoTaskMemFree(pPath); } - #elif !(defined(__APPLE__) || defined(__ANDROID__)) + #elif defined(__APPLE__) + + { + FFstrbuf* buffer = (FFstrbuf*) ffListAdd(&state->configDirs); + ffStrbufInitS(buffer, state->passwd->pw_dir); + ffStrbufAppendS(buffer, "/Library/Preferences/"); + } + + #elif !defined(__ANDROID__) const char* xdgConfigHome = getenv("XDG_CONFIG_HOME"); if(ffStrSet(xdgConfigHome))