diff --git a/include/villas/config.hpp b/include/villas/config.hpp index f5253e6be..6f68629fa 100644 --- a/include/villas/config.hpp +++ b/include/villas/config.hpp @@ -28,7 +28,15 @@ #include #include -#include +#if __has_include() + #include + namespace fs = std::filesystem; +#elif __has_include() + #include + namespace fs = std::experimental::filesystem; +#else + error "Missing the header." +#endif #include #include @@ -74,7 +82,7 @@ protected: json_t * walkStrings(json_t *in, str_walk_fcn_t cb); /** Get the include dirs */ - std::list getIncludeDirs(FILE *f) const; + std::list getIncludeDirs(FILE *f) const; public: json_t *root; diff --git a/lib/config.cpp b/lib/config.cpp index 7dd45432f..94cf483aa 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -28,7 +28,15 @@ #include #include #include -#include +#if __has_include() + #include + namespace fs = std::filesystem; +#elif __has_include() + #include + namespace fs = std::experimental::filesystem; +#else + error "Missing the header." +#endif #include #include @@ -37,8 +45,6 @@ #include #include -namespace fs = std::filesystem; - using namespace villas; using namespace villas::node; @@ -123,7 +129,7 @@ json_t * Config::decode(FILE *f) return root; } -std::list Config::getIncludeDirs(FILE *f) const +std::list Config::getIncludeDirs(FILE *f) const { auto uri = fs::read_symlink(fs::path("/proc/self/fd") / std::to_string(fileno(f))); if (isLocalFile(uri)) {