Use std::filesystem instead of std::experimental

std::filesystem is fully supported in c++17, no need to keep
the experimental around anymore.

Note that the path append behavior changed, so appending an
absolute path replaces the path instead of appending, therefore
need to use .relative_path().

Tested: Did a code update on witherspoon and verified the sync
        path was correct.

Change-Id: Iffe42cf0ebd5537920c8fdbf9edcec640ab9c724
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/activation.hpp b/activation.hpp
index 4869c30..61c954e 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -13,7 +13,7 @@
 #include <xyz/openbmc_project/Software/ActivationBlocksTransition/server.hpp>
 
 #ifdef WANT_SIGNATURE_VERIFY
-#include <experimental/filesystem>
+#include <filesystem>
 #endif
 
 namespace phosphor
@@ -24,7 +24,7 @@
 {
 
 #ifdef WANT_SIGNATURE_VERIFY
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 #endif
 
 using AssociationList =
diff --git a/download_manager.cpp b/download_manager.cpp
index 6357ee8..a3811dd 100644
--- a/download_manager.cpp
+++ b/download_manager.cpp
@@ -8,7 +8,7 @@
 #include <unistd.h>
 
 #include <algorithm>
-#include <experimental/filesystem>
+#include <filesystem>
 #include <iostream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
@@ -24,7 +24,7 @@
 
 using namespace sdbusplus::xyz::openbmc_project::Common::Error;
 using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 void Download::downloadViaTFTP(std::string fileName, std::string serverAddress)
 {
diff --git a/image_manager.cpp b/image_manager.cpp
index e132465..226199c 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -14,7 +14,7 @@
 #include <algorithm>
 #include <cstring>
 #include <elog-errors.hpp>
-#include <experimental/filesystem>
+#include <filesystem>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/log.hpp>
 #include <string>
@@ -33,7 +33,7 @@
 using ManifestFail = Software::Image::ManifestFileFailure;
 using UnTarFail = Software::Image::UnTarFailure;
 using InternalFail = Software::Image::InternalFailure;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 struct RemovablePath
 {
diff --git a/image_verify.hpp b/image_verify.hpp
index d52281c..7ec0661 100644
--- a/image_verify.hpp
+++ b/image_verify.hpp
@@ -7,7 +7,7 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <set>
 #include <string>
 
@@ -18,7 +18,7 @@
 namespace image
 {
 
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 using Key_t = std::string;
 using Hash_t = std::string;
 using PublicKeyPath = fs::path;
diff --git a/item_updater.cpp b/item_updater.cpp
index 4e2ca45..9cac8dd 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -7,7 +7,7 @@
 #include "version.hpp"
 #include "xyz/openbmc_project/Software/Version/server.hpp"
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <fstream>
 #include <phosphor-logging/elog-errors.hpp>
 #include <phosphor-logging/elog.hpp>
@@ -32,7 +32,7 @@
 using namespace phosphor::logging;
 using namespace sdbusplus::xyz::openbmc_project::Software::Image::Error;
 using namespace phosphor::software::image;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 using NotAllowed = sdbusplus::xyz::openbmc_project::Common::Error::NotAllowed;
 
 void ItemUpdater::createActivation(sdbusplus::message::message& msg)
diff --git a/serialize.cpp b/serialize.cpp
index 31ac971..f5aeb11 100644
--- a/serialize.cpp
+++ b/serialize.cpp
@@ -3,7 +3,7 @@
 #include "serialize.hpp"
 
 #include <cereal/archives/json.hpp>
-#include <experimental/filesystem>
+#include <filesystem>
 #include <fstream>
 #include <phosphor-logging/log.hpp>
 #include <sdbusplus/server.hpp>
@@ -16,7 +16,7 @@
 {
 
 using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 const std::string priorityName = "priority";
 const std::string purposeName = "purpose";
diff --git a/serialize.hpp b/serialize.hpp
index 42a057b..aada2bf 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -4,7 +4,6 @@
 
 #include "version.hpp"
 
-#include <experimental/filesystem>
 #include <string>
 
 namespace phosphor
@@ -14,7 +13,6 @@
 namespace updater
 {
 
-namespace fs = std::experimental::filesystem;
 using VersionPurpose =
     sdbusplus::xyz::openbmc_project::Software::server::Version::VersionPurpose;
 
diff --git a/static/flash.cpp b/static/flash.cpp
index 82c2393..9bb2bba 100644
--- a/static/flash.cpp
+++ b/static/flash.cpp
@@ -5,7 +5,7 @@
 #include "activation.hpp"
 #include "images.hpp"
 
-#include <experimental/filesystem>
+#include <filesystem>
 
 namespace
 {
@@ -19,7 +19,7 @@
 namespace updater
 {
 
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 void Activation::flashWrite()
 {
diff --git a/sync_manager.cpp b/sync_manager.cpp
index 48d773b..d44a81b 100644
--- a/sync_manager.cpp
+++ b/sync_manager.cpp
@@ -6,7 +6,7 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <phosphor-logging/log.hpp>
 
 namespace phosphor
@@ -17,7 +17,7 @@
 {
 
 using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 int Sync::processEntry(int mask, const fs::path& entryPath)
 {
@@ -26,7 +26,8 @@
 
     if (pid == 0)
     {
-        fs::path dst(ALT_RWFS / entryPath);
+        fs::path dst(ALT_RWFS);
+        dst /= entryPath.relative_path();
 
         // rsync needs an additional --delete argument to handle file deletions
         // so need to differentiate between the different file events.
diff --git a/sync_manager.hpp b/sync_manager.hpp
index 45bfca4..98e7b95 100644
--- a/sync_manager.hpp
+++ b/sync_manager.hpp
@@ -1,6 +1,6 @@
 #pragma once
 
-#include <experimental/filesystem>
+#include <filesystem>
 
 namespace phosphor
 {
@@ -9,7 +9,7 @@
 namespace manager
 {
 
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 /** @class Sync
  *  @brief Contains filesystem sync functions.
diff --git a/sync_watch.cpp b/sync_watch.cpp
index c0f0f21..e4942fd 100644
--- a/sync_watch.cpp
+++ b/sync_watch.cpp
@@ -5,7 +5,7 @@
 #include <sys/inotify.h>
 #include <unistd.h>
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <fstream>
 #include <phosphor-logging/log.hpp>
 
@@ -17,7 +17,6 @@
 {
 
 using namespace phosphor::logging;
-namespace fs = std::experimental::filesystem;
 
 void SyncWatch::addInotifyWatch(const fs::path& path)
 {
diff --git a/sync_watch.hpp b/sync_watch.hpp
index 126c50c..d85ac8c 100644
--- a/sync_watch.hpp
+++ b/sync_watch.hpp
@@ -2,7 +2,7 @@
 
 #include <systemd/sd-event.h>
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <functional>
 #include <map>
 
@@ -13,7 +13,7 @@
 namespace manager
 {
 
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 /** @class SyncWatch
  *
diff --git a/test/utest.cpp b/test/utest.cpp
index 20b2c2a..94e7c96 100644
--- a/test/utest.cpp
+++ b/test/utest.cpp
@@ -4,7 +4,7 @@
 #include <openssl/sha.h>
 #include <stdlib.h>
 
-#include <experimental/filesystem>
+#include <filesystem>
 #include <fstream>
 #include <iostream>
 #include <sstream>
diff --git a/watch.cpp b/watch.cpp
index 090e560..33d5ec0 100644
--- a/watch.cpp
+++ b/watch.cpp
@@ -9,7 +9,7 @@
 
 #include <cstddef>
 #include <cstring>
-#include <experimental/filesystem>
+#include <filesystem>
 #include <phosphor-logging/log.hpp>
 #include <stdexcept>
 #include <string>
@@ -23,7 +23,7 @@
 
 using namespace phosphor::logging;
 using namespace std::string_literals;
-namespace fs = std::experimental::filesystem;
+namespace fs = std::filesystem;
 
 Watch::Watch(sd_event* loop, std::function<int(std::string&)> imageCallback) :
     imageCallback(imageCallback)