mirror of
https://github.com/obsqrbtz/clrsync.git
synced 2026-04-08 20:19:04 +03:00
fix: try $XDG_CONFIG_HOME first
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
namespace clrsync::core
|
||||
{
|
||||
|
||||
const std::string GIT_SEMVER = "1.1.1+git.gf3e842d";
|
||||
const std::string GIT_SEMVER = "1.1.2+git.g25fbc78";
|
||||
|
||||
const std::string version_string();
|
||||
} // namespace clrsync::core
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "core/io/toml_file.hpp"
|
||||
|
||||
#include "core/palette/color.hpp"
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
@@ -68,6 +69,9 @@ Result<void> config::initialize(std::unique_ptr<clrsync::core::io::file> file)
|
||||
|
||||
std::filesystem::path config::get_user_config_dir()
|
||||
{
|
||||
const char *xdg_config_home = std::getenv("XDG_CONFIG_HOME");
|
||||
if (xdg_config_home && xdg_config_home[0] != '\0')
|
||||
return normalize_path(xdg_config_home) / "clrsync";
|
||||
std::filesystem::path home = normalize_path("~");
|
||||
return home / ".config" / "clrsync";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user