Mercurial > minori
diff src/core/filesystem.cc @ 176:121c2d5b321f
anime/db: finalize anime db cache
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Fri, 01 Dec 2023 13:12:26 -0500 |
parents | 80d6b28eb29f |
children | 8548dc425697 |
line wrap: on
line diff
--- a/src/core/filesystem.cc Thu Nov 30 13:52:26 2023 -0500 +++ b/src/core/filesystem.cc Fri Dec 01 13:12:26 2023 -0500 @@ -39,21 +39,27 @@ #ifdef WIN32 std::filesystem::path path; wchar_t* buf; + if (SHGetKnownFolderPath(FOLDERID_RoamingAppData, KF_FLAG_CREATE, NULL, &buf) == S_OK) path = buf; else return std::filesystem::path(); + CoTaskMemFree(buf); + return path / CONFIG_DIR; #elif defined(MACOSX) return std::filesystem::path(osx::GetApplicationSupportDirectory()) / CONFIG_DIR; #else // just assume POSIX std::filesystem::path path; const char* home = getenv("HOME"); + # ifdef __linux__ if (!home) home = getpwuid(getuid())->pw_dir; # endif // __linux__ + + /* only do this if the home directory was really found */ if (home) return std::filesystem::path(home) / ".config" / CONFIG_DIR; else