]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
tools/ceph-dencoder: include experimental/filesystem as an alternative
authorKefu Chai <tchaikov@gmail.com>
Fri, 2 Sep 2022 00:27:23 +0000 (08:27 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 2 Sep 2022 01:16:08 +0000 (09:16 +0800)
in case we use pre C++17 C++ compiler and standard library.

this change is not cherry-picked from main, as we are using new C++
stanrdard library which is compliant with C++20. so no need to worry
about this.

Signed-off-by: Tim Serong <tserong@suse.com>
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/tools/ceph-dencoder/ceph_dencoder.cc
src/tools/ceph-dencoder/denc_plugin.h

index c8993398b693a6e5ed7ea7af059ad6e8d4de633a..42060f860e394a36ba0e784755f36775d0977ed0 100644 (file)
@@ -69,7 +69,7 @@ vector<DencoderPlugin> load_plugins()
   if (auto ceph_lib = getenv("CEPH_LIB"); ceph_lib) {
     mod_dir = ceph_lib;
   } else if (fs::is_regular_file("CMakeCache.txt")) {
-    mod_dir = std::filesystem::canonical("lib");
+    mod_dir = fs::canonical("lib");
   }
   vector<DencoderPlugin> dencoder_plugins;
   for (auto& entry : fs::directory_iterator(mod_dir)) {
index 3b17a4f55da8e31c4bb6169f3a5a9d9044290b8d..58690a4b9c7c497e5d6f8f1e855fb21b8f3d536b 100644 (file)
@@ -1,11 +1,15 @@
 #include <dlfcn.h>
+#if __has_include(<filesystem>)
 #include <filesystem>
+namespace fs = std::filesystem;
+#else
+#include <experimental/filesystem>
+namespace fs = std::experimental::filesystem;
+#endif
 #include <vector>
 
 #include "denc_registry.h"
 
-namespace fs = std::filesystem;
-
 class DencoderPlugin {
   using dencoders_t = std::vector<std::pair<std::string, Dencoder*>>;
 public: