From 226ccecd19fb85838a3066ef7c8a51124f80e302 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 13 Feb 2024 18:06:36 +0000 Subject: [PATCH] Remove usage of std::filesystem Signed-off-by: Steffen Vogel --- include/villas/config_class.hpp | 4 ++-- include/villas/super_node.hpp | 2 +- lib/config.cpp | 8 +++++++- lib/nodes/fpga.cpp | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/villas/config_class.hpp b/include/villas/config_class.hpp index a499fcab7..a0b42f268 100644 --- a/include/villas/config_class.hpp +++ b/include/villas/config_class.hpp @@ -33,7 +33,7 @@ protected: Logger logger; std::list includeDirectories; - std::filesystem::path configPath; + std::string configPath; // Check if file exists on local system. static bool isLocalFile(const std::string &uri) { @@ -90,7 +90,7 @@ public: json_t *load(const std::string &u, bool resolveIncludes = true, bool resolveEnvVars = true); - std::filesystem::path &getConfigPath() { return configPath; } + std::string &getConfigPath() { return configPath; } }; } // namespace node diff --git a/include/villas/super_node.hpp b/include/villas/super_node.hpp index 709966938..69968ece6 100644 --- a/include/villas/super_node.hpp +++ b/include/villas/super_node.hpp @@ -143,7 +143,7 @@ public: json_t *getConfig() { return config.root; } - std::filesystem::path &getConfigPath() { return config.getConfigPath(); } + std::string &getConfigPath() { return config.getConfigPath(); } std::string getConfigUri() const { return uri; } diff --git a/lib/config.cpp b/lib/config.cpp index 45de082d2..f1df13a66 100644 --- a/lib/config.cpp +++ b/lib/config.cpp @@ -72,7 +72,13 @@ json_t *Config::load(const std::string &u, bool resolveInc, FILE *Config::loadFromStdio() { logger->info("Reading configuration from standard input"); - configPath = std::filesystem::current_path(); + + auto *cwd = new char[PATH_MAX]; + + configPath = getcwd(cwd, PATH_MAX); + + delete[] cwd; + return stdin; } diff --git a/lib/nodes/fpga.cpp b/lib/nodes/fpga.cpp index d85486695..6e0ee2de9 100644 --- a/lib/nodes/fpga.cpp +++ b/lib/nodes/fpga.cpp @@ -203,7 +203,7 @@ int FpgaNodeFactory::start(SuperNode *sn) { vfioContainer = std::make_shared(); if (cards.empty()) { - std::filesystem::path searchPath = sn->getConfigPath().parent_path(); + std::string searchPath = sn->getConfigPath() + "/.."; createCards(sn->getConfig(), cards, searchPath); }