Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / mount / step_mount_install.cc
index a10d291..d4313f9 100644 (file)
@@ -4,9 +4,7 @@
 
 #include "step/mount/step_mount_install.h"
 
-#include <boost/filesystem/operations.hpp>
-#include <boost/filesystem/path.hpp>
-
+#include <filesystem>
 #include <string>
 
 #include "common/shared_dirs.h"
@@ -16,9 +14,8 @@
 #include "common/utils/file_util.h"
 #include "common/utils/request.h"
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
 namespace ci = common_installer;
+namespace fs = std::filesystem;
 
 namespace common_installer {
 namespace mount {
@@ -30,11 +27,11 @@ Step::Status StepMountInstall::process() {
     return Status::APP_DIR_ERROR;
   }
 
-  bf::path zip_destination_path =
+  fs::path zip_destination_path =
       GetZipPackageLocation(context_->GetPkgPath(), context_->pkgid.get());
-  if (!bf::exists(zip_destination_path.parent_path())) {
-    bs::error_code error;
-    bf::create_directories(zip_destination_path.parent_path(), error);
+  if (!fs::exists(zip_destination_path.parent_path())) {
+    std::error_code error;
+    fs::create_directories(zip_destination_path.parent_path(), error);
     if (error) {
       LOG(ERROR) << "Failed to create diretory: "
                  << zip_destination_path.parent_path();
@@ -49,7 +46,7 @@ Step::Status StepMountInstall::process() {
   context_->manifest_data.get()->zip_mount_file =
       strdup(zip_destination_path.c_str());
 
-  bf::path mount_point = GetMountLocation(context_->GetPkgPath());
+  fs::path mount_point = GetMountLocation(context_->GetPkgPath());
   auto zip_final = CreateZipInterface(mount_point);
   if (!zip_final->MountZip(zip_destination_path)) {
     LOG(ERROR) << "Failed to mount zip package in installation path";
@@ -61,7 +58,7 @@ Step::Status StepMountInstall::process() {
 }
 
 Step::Status StepMountInstall::UmountPackagePath() {
-  bf::path mount_point = GetMountLocation(context_->GetPkgPath());
+  fs::path mount_point = GetMountLocation(context_->GetPkgPath());
   auto zip_final = CreateZipInterface(mount_point);
   if (!zip_final->UnmountZip()) {
     LOG(ERROR) << "Failed to unmount zip package after installation";
@@ -72,15 +69,15 @@ Step::Status StepMountInstall::UmountPackagePath() {
 }
 
 Step::Status StepMountInstall::undo() {
-  bs::error_code error;
+  std::error_code error;
   UmountPackagePath();
-  bf::remove(GetZipPackageLocation(context_->GetPkgPath(),
+  fs::remove(GetZipPackageLocation(context_->GetPkgPath(),
                                    context_->pkgid.get()), error);
   if (error) {
     LOG(ERROR) << "Failed to remove zip package";
     return Status::APP_DIR_ERROR;
   }
-  bf::remove_all(context_->GetPkgPath(), error);
+  fs::remove_all(context_->GetPkgPath(), error);
   if (error) {
     LOG(ERROR) << "Failed to remove package content";
     return Status::APP_DIR_ERROR;
@@ -93,7 +90,7 @@ Step::Status StepMountInstall::precheck() {
     LOG(ERROR) << "root_application_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!bf::exists(context_->root_application_path.get())) {
+  if (!fs::exists(context_->root_application_path.get())) {
     LOG(ERROR) << "root_application_path ("
                << context_->root_application_path.get()
                << ") path does not exist";
@@ -104,7 +101,7 @@ Step::Status StepMountInstall::precheck() {
     LOG(ERROR) << "unpacked_dir_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!bf::exists(context_->unpacked_dir_path.get())) {
+  if (!fs::exists(context_->unpacked_dir_path.get())) {
     LOG(ERROR) << "unpacked_dir_path ("
                << context_->unpacked_dir_path.get()
                << ") path does not exist";
@@ -120,7 +117,7 @@ Step::Status StepMountInstall::precheck() {
 }
 
 std::unique_ptr<IZipInterface> StepMountInstall::CreateZipInterface(
-    const boost::filesystem::path& mount_path) {
+    const fs::path& mount_path) {
   std::unique_ptr<IZipInterface> zip_interface(
       new TzipInterface(mount_path));
   return zip_interface;