Mercurial > minori
comparison src/core/filesystem.cc @ 138:28842a8d0c6b
dep/animia: huge refactor (again...)
but this time, it actually compiles! and it WORKS! (on win32... not sure about
other platforms...)
configuring players is still not supported: at some point I'll prune something
up...
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 12 Nov 2023 04:53:19 -0500 |
parents | 7d3ad9529c4c |
children | 80d6b28eb29f |
comparison
equal
deleted
inserted
replaced
137:69db40272acd | 138:28842a8d0c6b |
---|---|
41 CoTaskMemFree(buf); | 41 CoTaskMemFree(buf); |
42 return path / CONFIG_DIR; | 42 return path / CONFIG_DIR; |
43 #elif defined(MACOSX) | 43 #elif defined(MACOSX) |
44 return std::filesystem::path(osx::GetApplicationSupportDirectory()) / CONFIG_DIR; | 44 return std::filesystem::path(osx::GetApplicationSupportDirectory()) / CONFIG_DIR; |
45 #else // just assume POSIX | 45 #else // just assume POSIX |
46 std::filesystem::path path; | |
46 const char* home = getenv("HOME"); | 47 const char* home = getenv("HOME"); |
47 if (home != NULL) | |
48 path = home; | |
49 # ifdef __linux__ | 48 # ifdef __linux__ |
50 else | 49 if (!home) |
51 path = getpwuid(getuid())->pw_dir; | 50 home = getpwuid(getuid())->pw_dir; |
52 # endif // __linux__ | 51 # endif // __linux__ |
53 if (!path.empty()) | 52 if (!home) |
54 return path / ".config"; | 53 return std::filesystem::path(home) / ".config"; |
55 else | 54 else |
56 return std::filesystem::path(); | 55 return std::filesystem::path(); |
57 #endif // !WIN32 && !MACOSX | 56 #endif // !WIN32 && !MACOSX |
58 } | 57 } |
59 | 58 |