mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
config: enable compile with GCC versions older than 8 (where filesystem is still in experimental/filesystem)
This commit is contained in:
parent
d3b1da4957
commit
d3a04660e4
2 changed files with 20 additions and 6 deletions
|
@ -28,7 +28,15 @@
|
|||
|
||||
#include <functional>
|
||||
#include <regex>
|
||||
#include <filesystem>
|
||||
#if __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#elif __has_include(<experimental/filesystem>)
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
error "Missing the <filesystem> header."
|
||||
#endif
|
||||
#include <jansson.h>
|
||||
|
||||
#include <villas/node/config.h>
|
||||
|
@ -74,7 +82,7 @@ protected:
|
|||
json_t * walkStrings(json_t *in, str_walk_fcn_t cb);
|
||||
|
||||
/** Get the include dirs */
|
||||
std::list<std::filesystem::path> getIncludeDirs(FILE *f) const;
|
||||
std::list<fs::path> getIncludeDirs(FILE *f) const;
|
||||
|
||||
public:
|
||||
json_t *root;
|
||||
|
|
|
@ -28,7 +28,15 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <filesystem>
|
||||
#if __has_include(<filesystem>)
|
||||
#include <filesystem>
|
||||
namespace fs = std::filesystem;
|
||||
#elif __has_include(<experimental/filesystem>)
|
||||
#include <experimental/filesystem>
|
||||
namespace fs = std::experimental::filesystem;
|
||||
#else
|
||||
error "Missing the <filesystem> header."
|
||||
#endif
|
||||
|
||||
#include <villas/utils.hpp>
|
||||
#include <villas/log.hpp>
|
||||
|
@ -37,8 +45,6 @@
|
|||
#include <villas/node/exceptions.hpp>
|
||||
#include <villas/config_helper.hpp>
|
||||
|
||||
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<std::filesystem::path> Config::getIncludeDirs(FILE *f) const
|
||||
std::list<fs::path> Config::getIncludeDirs(FILE *f) const
|
||||
{
|
||||
auto uri = fs::read_symlink(fs::path("/proc/self/fd") / std::to_string(fileno(f)));
|
||||
if (isLocalFile(uri)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue