summaryrefslogtreecommitdiffstats
path: root/sensordatahandler.cpp
diff options
context:
space:
mode:
authorVernon Mauery <vernon.mauery@intel.com>2018-07-20 10:52:36 -0700
committerVernon Mauery <vernon.mauery@linux.intel.com>2018-08-08 17:06:54 +0000
commit185b9f8b9d71e92cd31ee32baa09b5807c4a46e9 (patch)
tree30a54df77abcd3729f3930c58a02c9f7fa390958 /sensordatahandler.cpp
parentc5046574c66b835173d00b7ed21e2bc008d5ca5f (diff)
downloadphosphor-host-ipmid-185b9f8b9d71e92cd31ee32baa09b5807c4a46e9.tar.gz
phosphor-host-ipmid-185b9f8b9d71e92cd31ee32baa09b5807c4a46e9.zip
Standardize use of filesystem
If <filesystem> exists, use that, if it doesn't, try <experimental/filesystem>. Either way, access it from std via a namespace splice. Change-Id: I5b35ee9f74b88e188cb3ca3fed9abaec64933697 Signed-off-by: Vernon Mauery <vernon.mauery@intel.com>
Diffstat (limited to 'sensordatahandler.cpp')
-rw-r--r--sensordatahandler.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/sensordatahandler.cpp b/sensordatahandler.cpp
index 2d4ac3a..ef5089a 100644
--- a/sensordatahandler.cpp
+++ b/sensordatahandler.cpp
@@ -1,5 +1,15 @@
#include <bitset>
+#if __has_include(<filesystem>)
+#include <filesystem>
+#elif __has_include(<experimental/filesystem>)
#include <experimental/filesystem>
+namespace std {
+ // splice experimental::filesystem into std
+ namespace filesystem = std::experimental::filesystem;
+}
+#else
+# error filesystem not available
+#endif
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include "xyz/openbmc_project/Common/error.hpp"
@@ -409,7 +419,7 @@ namespace get
GetSensorResponse assertion(const Info& sensorInfo)
{
- namespace fs = std::experimental::filesystem;
+ namespace fs = std::filesystem;
fs::path path{ipmi::sensor::inventoryRoot};
path += sensorInfo.sensorPath;
OpenPOWER on IntegriCloud