mirror of
				https://github.com/rad4day/Waybar.git
				synced 2025-10-28 23:12:29 +01:00 
			
		
		
		
	fix(battery): use path for the / operator
This commit is contained in:
		| @@ -47,21 +47,21 @@ void waybar::modules::Battery::worker() { | ||||
|  | ||||
| void waybar::modules::Battery::getBatteries() { | ||||
|   try { | ||||
|     for (auto const& node : fs::directory_iterator(data_dir_)) { | ||||
|     for (auto& node : fs::directory_iterator(data_dir_)) { | ||||
|       if (!fs::is_directory(node)) { | ||||
|         continue; | ||||
|       } | ||||
|       auto dir_name = node.path().filename(); | ||||
|       auto bat_defined = config_["bat"].isString(); | ||||
|       if (((bat_defined && dir_name == config_["bat"].asString()) || !bat_defined) && | ||||
|           fs::exists(node / "capacity") && fs::exists(node / "uevent") && | ||||
|           fs::exists(node / "status")) { | ||||
|         batteries_.push_back(node); | ||||
|           fs::exists(node.path() / "capacity") && fs::exists(node.path() / "uevent") && | ||||
|           fs::exists(node.path() / "status")) { | ||||
|         batteries_.push_back(node.path()); | ||||
|       } | ||||
|       auto adap_defined = config_["adapter"].isString(); | ||||
|       if (((adap_defined && dir_name == config_["adapter"].asString()) || !adap_defined) && | ||||
|           fs::exists(node / "online")) { | ||||
|         adapter_ = node; | ||||
|           fs::exists(node.path() / "online")) { | ||||
|         adapter_ = node.path(); | ||||
|       } | ||||
|     } | ||||
|   } catch (fs::filesystem_error& e) { | ||||
|   | ||||
| @@ -8,11 +8,8 @@ waybar::modules::Temperature::Temperature(const std::string& id, const Json::Val | ||||
|     auto zone = config_["thermal-zone"].isInt() ? config_["thermal-zone"].asInt() : 0; | ||||
|     file_path_ = fmt::format("/sys/class/thermal/thermal_zone{}/temp", zone); | ||||
|   } | ||||
| #ifdef FILESYSTEM_EXPERIMENTAL | ||||
|   if (!std::experimental::filesystem::exists(file_path_)) { | ||||
| #else | ||||
|   if (!std::filesystem::exists(file_path_)) { | ||||
| #endif | ||||
|   std::ifstream temp(file_path_); | ||||
|   if (!temp.is_open()) { | ||||
|     throw std::runtime_error("Can't open " + file_path_); | ||||
|   } | ||||
|   label_.set_name("temperature"); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Alex
					Alex