add option for when filesystem still lives in the experimental namespace

This commit is contained in:
Lucas L. Treffenstädt 2018-11-02 20:59:41 +01:00
parent 00e7e87f55
commit 236be90c2f
5 changed files with 23 additions and 2 deletions

View File

@ -1,6 +1,10 @@
#pragma once #pragma once
#include <filesystem> #ifdef FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <fmt/format.h> #include <fmt/format.h>
@ -11,7 +15,11 @@
namespace waybar::modules { namespace waybar::modules {
#ifdef FILESYSTEM_EXPERIMENTAL
namespace fs = std::experimental::filesystem;
#else
namespace fs = std::filesystem; namespace fs = std::filesystem;
#endif
class Battery : public ALabel { class Battery : public ALabel {
public: public:

View File

@ -3,7 +3,11 @@
#include <dbus-status-notifier-item.h> #include <dbus-status-notifier-item.h>
#include <gtkmm.h> #include <gtkmm.h>
#include <json/json.h> #include <json/json.h>
#include <filesystem> #ifdef FILESYSTEM_EXPERIMENTAL
#include <experimental/filesystem>
#else
#include <filesystem>
#endif
namespace waybar::modules::SNI { namespace waybar::modules::SNI {

View File

@ -83,6 +83,10 @@ if dbusmenu_gtk.found()
) )
endif endif
if get_option('filesystem-experimental')
add_project_arguments('-DFILESYSTEM_EXPERIMENTAL', language: 'cpp')
endif
subdir('protocol') subdir('protocol')
executable( executable(

View File

@ -2,3 +2,4 @@ option('libnl', type: 'feature', value: 'auto', description: 'Enable libnl suppo
option('pulseaudio', type: 'feature', value: 'auto', description: 'Enable support for pulseaudio') option('pulseaudio', type: 'feature', value: 'auto', description: 'Enable support for pulseaudio')
option('dbusmenu-gtk', type: 'feature', value: 'auto', description: 'Enable support for tray') option('dbusmenu-gtk', type: 'feature', value: 'auto', description: 'Enable support for tray')
option('out', type: 'string', value : '/', description: 'output prefix directory') option('out', type: 'string', value : '/', description: 'output prefix directory')
option('filesystem-experimental', type: 'boolean', value: 'true', description: 'Does filesystem still live in experimental?')

View File

@ -190,7 +190,11 @@ void waybar::modules::SNI::Item::updateImage()
if (!icon_name.empty()) { if (!icon_name.empty()) {
try { try {
// Try to find icons specified by path and filename // 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)) { if (std::filesystem::exists(icon_name)) {
#endif
auto pixbuf = Gdk::Pixbuf::create_from_file(icon_name); auto pixbuf = Gdk::Pixbuf::create_from_file(icon_name);
if (pixbuf->gobj() != nullptr) { if (pixbuf->gobj() != nullptr) {
// An icon specified by path and filename may be the wrong size for // An icon specified by path and filename may be the wrong size for