hyprctl: verify runtime dir exists in instances()

ref #8579
This commit is contained in:
Vaxry 2024-11-25 14:42:06 +00:00
parent 0ddb952d7a
commit 2687788236

View file

@ -66,6 +66,11 @@ std::string getRuntimeDir() {
std::vector<SInstanceData> instances() { std::vector<SInstanceData> instances() {
std::vector<SInstanceData> result; std::vector<SInstanceData> result;
try {
if (!std::filesystem::exists(getRuntimeDir()))
return {};
} catch (std::exception& e) { return {}; }
for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) { for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) {
if (!el.is_directory() || !std::filesystem::exists(el.path().string() + "/hyprland.lock")) if (!el.is_directory() || !std::filesystem::exists(el.path().string() + "/hyprland.lock"))
continue; continue;