Skip to content
Snippets Groups Projects
Commit a3d1eff5 authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

remove subdir

parent 1a5c872d
No related branches found
No related tags found
No related merge requests found
Pipeline #29160 failed
...@@ -16,7 +16,6 @@ namespace file { ...@@ -16,7 +16,6 @@ namespace file {
std::filesystem::path home_dir(); std::filesystem::path home_dir();
std::filesystem::path config_dir(); std::filesystem::path config_dir();
std::filesystem::path config_dir(const std::filesystem::path& subdirectory);
bool is_file(const std::filesystem::path &path); bool is_file(const std::filesystem::path &path);
......
...@@ -161,7 +161,7 @@ optional<string> ftl::config::locateFile(const string &name) { ...@@ -161,7 +161,7 @@ optional<string> ftl::config::locateFile(const string &name) {
} }
if (is_file("./"+name)) return "./"+name; if (is_file("./"+name)) return "./"+name;
if (is_file(config_dir("ftl") / name)) return (ftl::file::config_dir("ftl") / name).string(); if (is_file(config_dir() / name)) return (ftl::file::config_dir() / name).string();
if (is_file(string(FTL_GLOBAL_CONFIG_ROOT) +"/"+ name)) return string(FTL_GLOBAL_CONFIG_ROOT) +"/"+ name; if (is_file(string(FTL_GLOBAL_CONFIG_ROOT) +"/"+ name)) return string(FTL_GLOBAL_CONFIG_ROOT) +"/"+ name;
return {}; return {};
} }
......
...@@ -19,20 +19,16 @@ path home_dir() { ...@@ -19,20 +19,16 @@ path home_dir() {
return std::filesystem::absolute(path(home)); return std::filesystem::absolute(path(home));
} }
path config_dir(const path& subdir) { path config_dir() {
#if defined(_MSC_VER) #if defined(_MSC_VER)
return path(std::getenv("APPDATA")) / subdir; return path(std::getenv("APPDATA")) / "ftl";
#elif defined(__GNUC__) #elif defined(__GNUC__)
return home_dir() / ".config"; return home_dir() / ".config" / "ftl";
#else #else
static_assert(false, "unsupported compiler"); static_assert(false, "unsupported compiler");
#endif #endif
} }
path config_dir() {
return config_dir(path());
}
bool is_file(const path& p) { bool is_file(const path& p) {
return std::filesystem::is_regular_file(p); return std::filesystem::is_regular_file(p);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment