Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / tzip_interface.cc
index f215674..fb6d6e3 100644 (file)
@@ -6,15 +6,14 @@
 
 #include <manifest_parser/utils/logging.h>
 
-#include <boost/filesystem.hpp>
-
 #include <gio/gio.h>
 #include <glib.h>
 
 #include <cstdlib>
 #include <functional>
+#include <filesystem>
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace {
 
@@ -88,10 +87,10 @@ class DBusProxy {
 
 class TzipInterface::Pimpl {
  public:
-  explicit Pimpl(const boost::filesystem::path& mount_path) :
+  explicit Pimpl(const std::filesystem::path& mount_path) :
     mount_path_(mount_path), dbus_proxy_(new DBusProxy()) { }
 
-  bool MountZip(const boost::filesystem::path& zip_path) {
+  bool MountZip(const std::filesystem::path& zip_path) {
     zip_path_ = zip_path;
 
     if (IsMounted()) {
@@ -100,19 +99,19 @@ class TzipInterface::Pimpl {
       UnmountZip();
     }
 
-    if (bf::exists(mount_path_)) {
+    if (fs::exists(mount_path_)) {
       LOG(WARNING) << "Mount path(" << mount_path_ << ") already exists! "
                    << "We will remove it...";
-      bf::remove(mount_path_);
+      fs::remove(mount_path_);
     }
 
-    if (!bf::exists(zip_path)) {
+    if (!fs::exists(zip_path)) {
       LOG(WARNING) << "zip path(" << zip_path << ") doesn't exist!";
       return false;
     }
 
-    const char* mount_path_str = mount_path_.string().c_str();
-    const char* zip_path_str = zip_path_.string().c_str();
+    const char* mount_path_str = mount_path_.c_str();
+    const char* zip_path_str = zip_path_.c_str();
     const char* tzip_smack_rule = kTzipSmackRule;
 
     GVariant* r = dbus_proxy_->ProxyCallSync(kTzipMountMethod,
@@ -129,7 +128,7 @@ class TzipInterface::Pimpl {
   }
 
   bool UnmountZip() {
-    const char* mount_path_str = mount_path_.string().c_str();
+    const char* mount_path_str = mount_path_.c_str();
 
     GVariant* r = dbus_proxy_->ProxyCallSync(kTzipUnmountMethod,
         g_variant_new("(s)", mount_path_str));
@@ -146,7 +145,7 @@ class TzipInterface::Pimpl {
 
  private:
   bool IsMounted() {
-    const char* mount_path_str = mount_path_.string().c_str();
+    const char* mount_path_str = mount_path_.c_str();
     GVariant* r = dbus_proxy_->ProxyCallSync(kTzipIsMountedMethod,
         g_variant_new("(s)", mount_path_str));
     if (!r)
@@ -181,17 +180,17 @@ class TzipInterface::Pimpl {
     return true;
   }
 
-  boost::filesystem::path mount_path_;
-  boost::filesystem::path zip_path_;
+  std::filesystem::path mount_path_;
+  std::filesystem::path zip_path_;
   std::unique_ptr<DBusProxy> dbus_proxy_;
 };
 
-TzipInterface::TzipInterface(const boost::filesystem::path& mount_path)
+TzipInterface::TzipInterface(const std::filesystem::path& mount_path)
   : impl_(new Pimpl(mount_path)) {}
 
 TzipInterface::~TzipInterface() { }
 
-bool TzipInterface::MountZip(const boost::filesystem::path& zip_path) {
+bool TzipInterface::MountZip(const std::filesystem::path& zip_path) {
   return impl_->MountZip(zip_path);
 }