From c844d7ac2e70945234d169356866b2c1d965e274 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Sun, 11 Aug 2019 15:23:37 +0000 Subject: [PATCH] tray: drop std::filesystem dependency --- include/factory.hpp | 2 +- include/modules/sni/item.hpp | 5 ----- src/factory.cpp | 2 +- src/modules/sni/item.cpp | 8 +++----- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/include/factory.hpp b/include/factory.hpp index a337335..a5515b8 100644 --- a/include/factory.hpp +++ b/include/factory.hpp @@ -14,7 +14,7 @@ #include "modules/idle_inhibitor.hpp" #include "modules/memory.hpp" #include "modules/disk.hpp" -#if defined(HAVE_DBUSMENU) && !defined(NO_FILESYSTEM) +#ifdef HAVE_DBUSMENU #include "modules/sni/tray.hpp" #endif #ifdef HAVE_LIBNL diff --git a/include/modules/sni/item.hpp b/include/modules/sni/item.hpp index fc04673..3cbd0b7 100644 --- a/include/modules/sni/item.hpp +++ b/include/modules/sni/item.hpp @@ -10,11 +10,6 @@ #include #include #include -#ifdef FILESYSTEM_EXPERIMENTAL -#include -#else -#include -#endif namespace waybar::modules::SNI { diff --git a/src/factory.cpp b/src/factory.cpp index 73c9f9f..263071b 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -38,7 +38,7 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const { if (ref == "disk") { return new waybar::modules::Disk(id, config_[name]); } -#if defined(HAVE_DBUSMENU) && !defined(NO_FILESYSTEM) +#ifdef HAVE_DBUSMENU if (ref == "tray") { return new waybar::modules::SNI::Tray(id, bar_, config_[name]); } diff --git a/src/modules/sni/item.cpp b/src/modules/sni/item.cpp index b298e44..abf9556 100644 --- a/src/modules/sni/item.cpp +++ b/src/modules/sni/item.cpp @@ -1,6 +1,7 @@ #include "modules/sni/item.hpp" #include #include +#include template <> struct fmt::formatter : formatter { @@ -256,11 +257,8 @@ void Item::updateImage() { if (!icon_name.empty()) { try { // Try to find icons specified by path and filename -#ifdef FILESYSTEM_EXPERIMENTAL - if (std::experimental::filesystem::exists(icon_name)) { -#else - if (std::filesystem::exists(icon_name)) { -#endif + std::ifstream temp(icon_name); + if (temp.is_open()) { auto pixbuf = Gdk::Pixbuf::create_from_file(icon_name); if (pixbuf->gobj() != nullptr) { // An icon specified by path and filename may be the wrong size for