Skip to content

Commit 5ece0d9

Browse files
authored
Merge pull request #78 from mithodin/filesystem-experimental
add option for when filesystem still lives in the experimental namespace
2 parents 6ab01b1 + 0637888 commit 5ece0d9

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

include/modules/battery.hpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#pragma once
22

3-
#include <filesystem>
3+
#ifdef FILESYSTEM_EXPERIMENTAL
4+
#include <experimental/filesystem>
5+
#else
6+
#include <filesystem>
7+
#endif
48
#include <fstream>
59
#include <iostream>
610
#include <fmt/format.h>
@@ -11,7 +15,11 @@
1115

1216
namespace waybar::modules {
1317

18+
#ifdef FILESYSTEM_EXPERIMENTAL
19+
namespace fs = std::experimental::filesystem;
20+
#else
1421
namespace fs = std::filesystem;
22+
#endif
1523

1624
class Battery : public ALabel {
1725
public:

include/modules/sni/sni.hpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
#include <dbus-status-notifier-item.h>
44
#include <gtkmm.h>
55
#include <json/json.h>
6-
#include <filesystem>
6+
#ifdef FILESYSTEM_EXPERIMENTAL
7+
#include <experimental/filesystem>
8+
#else
9+
#include <filesystem>
10+
#endif
711

812
namespace waybar::modules::SNI {
913

meson.build

+6
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ if dbusmenu_gtk.found()
8383
)
8484
endif
8585

86+
compiler = meson.get_compiler('cpp')
87+
88+
if not compiler.has_header('filesystem')
89+
add_project_arguments('-DFILESYSTEM_EXPERIMENTAL', language: 'cpp')
90+
endif
91+
8692
subdir('protocol')
8793

8894
executable(

src/modules/sni/sni.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ void waybar::modules::SNI::Item::updateImage()
190190
if (!icon_name.empty()) {
191191
try {
192192
// Try to find icons specified by path and filename
193+
#ifdef FILESYSTEM_EXPERIMENTAL
194+
if (std::experimental::filesystem::exists(icon_name)) {
195+
#else
193196
if (std::filesystem::exists(icon_name)) {
197+
#endif
194198
auto pixbuf = Gdk::Pixbuf::create_from_file(icon_name);
195199
if (pixbuf->gobj() != nullptr) {
196200
// An icon specified by path and filename may be the wrong size for

0 commit comments

Comments
 (0)