c++17: drop experimental::filesystem
Use std::filesystem, and drop support for building with experimental
under c++14.
Tested: Build the repo.
Change-Id: I4af0d9c034dbfef5a65153ba5447b86c961aebf1
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/phosphor-ldap-mapper/ldap_mapper_serialize.cpp b/phosphor-ldap-mapper/ldap_mapper_serialize.cpp
index 3ef809e..65918fd 100644
--- a/phosphor-ldap-mapper/ldap_mapper_serialize.cpp
+++ b/phosphor-ldap-mapper/ldap_mapper_serialize.cpp
@@ -1,6 +1,7 @@
#include <cereal/archives/binary.hpp>
#include <cereal/types/string.hpp>
#include <fstream>
+#include <filesystem>
#include <phosphor-logging/log.hpp>
#include "config.h"
#include "ldap_mapper_serialize.hpp"
@@ -54,7 +55,8 @@
privilege(privilege, true);
}
-fs::path serialize(const LDAPMapperEntry& entry, Id id, const fs::path& dir)
+std::filesystem::path serialize(const LDAPMapperEntry& entry, Id id,
+ const std::filesystem::path& dir)
{
auto path = dir / std::to_string(id);
std::ofstream os(path.c_str(), std::ios::binary);
@@ -63,11 +65,11 @@
return path;
}
-bool deserialize(const fs::path& path, LDAPMapperEntry& entry)
+bool deserialize(const std::filesystem::path& path, LDAPMapperEntry& entry)
{
try
{
- if (fs::exists(path))
+ if (std::filesystem::exists(path))
{
std::ifstream is(path.c_str(), std::ios::in | std::ios::binary);
cereal::BinaryInputArchive iarchive(is);
@@ -79,13 +81,13 @@
catch (cereal::Exception& e)
{
log<level::ERR>(e.what());
- fs::remove(path);
+ std::filesystem::remove(path);
return false;
}
catch (const std::length_error& e)
{
log<level::ERR>(e.what());
- fs::remove(path);
+ std::filesystem::remove(path);
return false;
}
}