mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
fix(battery): add check for sys files
This commit is contained in:
parent
a423f7032d
commit
68f9ea3065
@ -5,7 +5,8 @@ waybar::modules::Battery::Battery(Json::Value config)
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
for (auto &node : fs::directory_iterator(_data_dir)) {
|
for (auto &node : fs::directory_iterator(_data_dir)) {
|
||||||
if (fs::is_directory(node) && fs::exists(node / "capacity"))
|
if (fs::is_directory(node) && fs::exists(node / "capacity")
|
||||||
|
&& fs::exists(node / "status") && fs::exists(node / "uevent"))
|
||||||
_batteries.push_back(node);
|
_batteries.push_back(node);
|
||||||
}
|
}
|
||||||
} catch (fs::filesystem_error &e) {
|
} catch (fs::filesystem_error &e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user