From: Kefu Chai Date: Fri, 2 Sep 2022 00:27:23 +0000 (+0800) Subject: tools/ceph-dencoder: include experimental/filesystem as an alternative X-Git-Tag: v16.2.11~358^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=770a4bd3b58ec71c764b423626da1d94e9f19584;p=ceph.git tools/ceph-dencoder: include experimental/filesystem as an alternative 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 Signed-off-by: Kefu Chai --- diff --git a/src/tools/ceph-dencoder/ceph_dencoder.cc b/src/tools/ceph-dencoder/ceph_dencoder.cc index c8993398b69..42060f860e3 100644 --- a/src/tools/ceph-dencoder/ceph_dencoder.cc +++ b/src/tools/ceph-dencoder/ceph_dencoder.cc @@ -69,7 +69,7 @@ vector 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 dencoder_plugins; for (auto& entry : fs::directory_iterator(mod_dir)) { diff --git a/src/tools/ceph-dencoder/denc_plugin.h b/src/tools/ceph-dencoder/denc_plugin.h index 3b17a4f55da..58690a4b9c7 100644 --- a/src/tools/ceph-dencoder/denc_plugin.h +++ b/src/tools/ceph-dencoder/denc_plugin.h @@ -1,11 +1,15 @@ #include +#if __has_include() #include +namespace fs = std::filesystem; +#else +#include +namespace fs = std::experimental::filesystem; +#endif #include #include "denc_registry.h" -namespace fs = std::filesystem; - class DencoderPlugin { using dencoders_t = std::vector>; public: