diff --git a/include/modules/temperature.hpp b/include/modules/temperature.hpp index e4a2cf59..13ec097d 100644 --- a/include/modules/temperature.hpp +++ b/include/modules/temperature.hpp @@ -4,6 +4,11 @@ #include #include "util/sleeper_thread.hpp" #include "ALabel.hpp" +#ifdef FILESYSTEM_EXPERIMENTAL +#include +#else +#include +#endif namespace waybar::modules { diff --git a/src/modules/temperature.cpp b/src/modules/temperature.cpp index 8311f5c7..272c685d 100644 --- a/src/modules/temperature.cpp +++ b/src/modules/temperature.cpp @@ -10,7 +10,13 @@ waybar::modules::Temperature::Temperature(const std::string& id, const Json::Val 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 + throw std::runtime_error("Can't open " + file_path_); + } label_.set_name("temperature"); if (!id.empty()) { label_.get_style_context()->add_class(id);