mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 03:22:31 +01:00
config: don't crash when getenv HOME returns null
This commit is contained in:
parent
cc98594c3a
commit
ede1e63f69
1 changed files with 6 additions and 1 deletions
|
@ -633,7 +633,12 @@ std::string CConfigManager::getConfigDir() {
|
||||||
if (xdgConfigHome && std::filesystem::path(xdgConfigHome).is_absolute())
|
if (xdgConfigHome && std::filesystem::path(xdgConfigHome).is_absolute())
|
||||||
return xdgConfigHome;
|
return xdgConfigHome;
|
||||||
|
|
||||||
return getenv("HOME") + std::string("/.config");
|
static const char* home = getenv("HOME");
|
||||||
|
|
||||||
|
if (!home)
|
||||||
|
throw std::runtime_error("Neither HOME nor XDG_CONFIG_HOME is set in the environment. Cannot determine config directory.");
|
||||||
|
|
||||||
|
return home + std::string("/.config");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getMainConfigPath() {
|
std::string CConfigManager::getMainConfigPath() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue