Mercurial > minori
diff src/filesystem.cpp @ 2:23d0d9319a00
Update
Also converted everything to LF from CRLF
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 12 Aug 2023 03:16:26 -0400 |
parents | 1ae666fdf9e2 |
children | 51ae25154b70 |
line wrap: on
line diff
--- a/src/filesystem.cpp Tue Aug 08 19:49:15 2023 -0400 +++ b/src/filesystem.cpp Sat Aug 12 03:16:26 2023 -0400 @@ -1,25 +1,25 @@ -#ifdef _WIN32 -#include <shlobj.h> -#elif defined(APPLE) -#include <NSSearchPathForDirectoriesInDomains.h> -#endif -#include <filesystem> -#include <limits.h> -#include "config.h" -#include "filesystem.h" - -std::filesystem::path get_config_path(void) { - std::filesystem::path cfg_path; -#ifdef _WIN32 - char buf[PATH_MAX+1]; - if (SHGetFolderPathAndSubDir(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, CONFIG_DIR, buf) == S_OK) - 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)))); -#else // just assume POSIX - cfg_path = std::filesystem::path(getenv("HOME")) / ".config" / CONFIG_DIR / CONFIG_NAME; -#endif - return cfg_path; -} +#ifdef _WIN32 +#include <shlobj.h> +#elif defined(APPLE) +#include <NSSearchPathForDirectoriesInDomains.h> +#endif +#include <filesystem> +#include <limits.h> +#include "config.h" +#include "filesystem.h" + +std::filesystem::path get_config_path(void) { + std::filesystem::path cfg_path; +#ifdef _WIN32 + char buf[PATH_MAX+1]; + if (SHGetFolderPathAndSubDir(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, CONFIG_DIR, buf) == S_OK) + 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)))); +#else // just assume POSIX + cfg_path = std::filesystem::path(getenv("HOME")) / ".config" / CONFIG_DIR / CONFIG_NAME; +#endif + return cfg_path; +}