Fix config directory.

This commit is contained in:
Dario 2024-12-17 14:26:00 -03:00
parent 374091b122
commit c22027be6a

View file

@ -30,13 +30,12 @@ inline std::filesystem::path GetUserPath()
if (homeDir != nullptr) if (homeDir != nullptr)
{ {
// Prefer to store in the .config directory if it exists. Use the home directory otherwise. // Prefer to store in the .config directory if it exists. Use the home directory otherwise.
const std::string dirName = "." USER_DIRECTORY;
std::filesystem::path homePath = homeDir; std::filesystem::path homePath = homeDir;
std::filesystem::path configPath = homePath / ".config"; std::filesystem::path configPath = homePath / ".config";
if (std::filesystem::exists(configPath)) if (std::filesystem::exists(configPath))
userPath = configPath / dirName; userPath = configPath / USER_DIRECTORY;
else else
userPath = homePath / dirName; userPath = homePath / ("." USER_DIRECTORY);
} }
#else #else
static_assert(false, "GetUserPath() not implemented for this platform."); static_assert(false, "GetUserPath() not implemented for this platform.");