fix(battery): add check for sys files

This commit is contained in:
Alexis 2018-08-13 17:11:47 +02:00
parent a423f7032d
commit 68f9ea3065
1 changed files with 2 additions and 1 deletions

View File

@ -5,7 +5,8 @@ waybar::modules::Battery::Battery(Json::Value config)
{
try {
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);
}
} catch (fs::filesystem_error &e) {