mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-28 02:31:54 -07:00
internal: Catch filesystem exceptions while iterating RunTimeDir (#10648)
This commit is contained in:
@@ -72,10 +72,13 @@ std::vector<SInstanceData> instances() {
|
|||||||
return {};
|
return {};
|
||||||
} catch (std::exception& e) { return {}; }
|
} catch (std::exception& e) { return {}; }
|
||||||
|
|
||||||
for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) {
|
std::error_code ec;
|
||||||
|
std::filesystem::directory_iterator it = std::filesystem::directory_iterator(getRuntimeDir(), std::filesystem::directory_options::skip_permission_denied, ec);
|
||||||
|
if (ec)
|
||||||
|
return {};
|
||||||
|
for (const auto& el : it) {
|
||||||
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;
|
||||||
|
|
||||||
// read lock
|
// read lock
|
||||||
SInstanceData* data = &result.emplace_back();
|
SInstanceData* data = &result.emplace_back();
|
||||||
data->id = el.path().filename().string();
|
data->id = el.path().filename().string();
|
||||||
|
Reference in New Issue
Block a user