mirror of
https://github.com/hyprwm/hyprutils.git
synced 2024-12-22 17:49:49 +01:00
ugh
This commit is contained in:
parent
a5afa58175
commit
2988a27c58
1 changed files with 11 additions and 6 deletions
|
@ -44,20 +44,20 @@ namespace Hyprutils::Path {
|
||||||
|
|
||||||
using T = std::optional<std::string>;
|
using T = std::optional<std::string>;
|
||||||
std::pair<T, T> findConfig(std::string programName) {
|
std::pair<T, T> findConfig(std::string programName) {
|
||||||
static const auto xdgConfigHome = getXdgConfigHome();
|
bool xdgConfigHomeExists = false;
|
||||||
|
static const auto xdgConfigHome = getXdgConfigHome();
|
||||||
if (xdgConfigHome.has_value()) {
|
if (xdgConfigHome.has_value()) {
|
||||||
|
xdgConfigHomeExists = true;
|
||||||
if (checkConfigExists(xdgConfigHome.value(), programName))
|
if (checkConfigExists(xdgConfigHome.value(), programName))
|
||||||
return std::make_pair(fullConfigPath(xdgConfigHome.value(), programName), xdgConfigHome);
|
return std::make_pair(fullConfigPath(xdgConfigHome.value(), programName), xdgConfigHome);
|
||||||
else
|
|
||||||
return std::make_pair(std::nullopt, xdgConfigHome);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const auto home = getHome();
|
bool homeExists = false;
|
||||||
|
static const auto home = getHome();
|
||||||
if (home.has_value()) {
|
if (home.has_value()) {
|
||||||
|
homeExists = true;
|
||||||
if (checkConfigExists(home.value(), programName))
|
if (checkConfigExists(home.value(), programName))
|
||||||
return std::make_pair(fullConfigPath(home.value(), programName), home);
|
return std::make_pair(fullConfigPath(home.value(), programName), home);
|
||||||
else
|
|
||||||
return std::make_pair(std::nullopt, home);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const auto xdgConfigDirs = getXdgConfigDirs();
|
static const auto xdgConfigDirs = getXdgConfigDirs();
|
||||||
|
@ -71,6 +71,11 @@ namespace Hyprutils::Path {
|
||||||
if (checkConfigExists("/etc/xdg", programName))
|
if (checkConfigExists("/etc/xdg", programName))
|
||||||
return std::make_pair(fullConfigPath("/etc/xdg", programName), std::nullopt);
|
return std::make_pair(fullConfigPath("/etc/xdg", programName), std::nullopt);
|
||||||
|
|
||||||
|
if (xdgConfigHomeExists)
|
||||||
|
return std::make_pair(std::nullopt, xdgConfigHome);
|
||||||
|
else if (homeExists)
|
||||||
|
return std::make_pair(std::nullopt, home);
|
||||||
|
|
||||||
return std::make_pair(std::nullopt, std::nullopt);
|
return std::make_pair(std::nullopt, std::nullopt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue