Mercurial > minori
diff src/filesystem.cpp @ 5:51ae25154b70
Fix OS X support code
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 12 Aug 2023 13:10:34 -0400 |
parents | 23d0d9319a00 |
children | 07a9095eaeed |
line wrap: on
line diff
--- a/src/filesystem.cpp Sat Aug 12 12:08:16 2023 -0400 +++ b/src/filesystem.cpp Sat Aug 12 13:10:34 2023 -0400 @@ -1,12 +1,14 @@ #ifdef _WIN32 #include <shlobj.h> -#elif defined(APPLE) -#include <NSSearchPathForDirectoriesInDomains.h> +#elif defined(MACOSX) +#include "sys/osx/filesystem.h" #endif #include <filesystem> #include <limits.h> +#include <QMessageBox> #include "config.h" #include "filesystem.h" +#include "string_utils.h" std::filesystem::path get_config_path(void) { std::filesystem::path cfg_path; @@ -16,8 +18,7 @@ cfg_path = std::filesystem::path(buf) / CONFIG_NAME; #elif defined(MACOSX) /* hope and pray that std::filesystem can handle tildes... */ - CFString string = (CFString)NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, true); - cfg_path = std::filesystem::path(StringUtils::Utf8ToWstr(std::string(CFStringGetCStringPtr(string, UTF8)))); + cfg_path = std::filesystem::path(StringUtils::Utf8ToWstr(osx::GetApplicationSupportDirectory())) / CONFIG_DIR / CONFIG_NAME; #else // just assume POSIX cfg_path = std::filesystem::path(getenv("HOME")) / ".config" / CONFIG_DIR / CONFIG_NAME; #endif