Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / filesystem / step_unzip.cc
index 0f82ec8..ed47f22 100644 (file)
@@ -7,20 +7,18 @@
 
 #include <tzplatform_config.h>
 
-#include <boost/filesystem.hpp>
-#include <boost/chrono/detail/system.hpp>
 #include <cassert>
 #include <cstdio>
 #include <cstdlib>
 #include <cstdint>
 #include <climits>
 #include <cstring>
+#include <filesystem>
 #include <string>
 
 #include "common/utils/file_util.h"
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
 
 namespace {
 
@@ -36,7 +34,7 @@ Step::Status StepUnzip::precheck() {
     LOG(ERROR) << "file_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!boost::filesystem::exists(context_->file_path.get())) {
+  if (!std::filesystem::exists(context_->file_path.get())) {
     LOG(ERROR) << "file_path ("
                << context_->file_path.get()
                << ") path does not exist";
@@ -47,7 +45,7 @@ Step::Status StepUnzip::precheck() {
     LOG(ERROR) << "root_application_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!boost::filesystem::exists(context_->root_application_path.get())) {
+  if (!std::filesystem::exists(context_->root_application_path.get())) {
     LOG(ERROR) << "root_application_path ("
                << context_->root_application_path.get()
                << ") path does not exist";
@@ -58,7 +56,7 @@ Step::Status StepUnzip::precheck() {
 }
 
 Step::Status StepUnzip::process() {
-  bf::path tmp_dir = GenerateTmpDir(kPackageUnpackDirPath);
+  fs::path tmp_dir = GenerateTmpDir(kPackageUnpackDirPath);
 
   int64_t required_size =
       GetUnpackedPackageSize(context_->file_path.get());
@@ -77,7 +75,7 @@ Step::Status StepUnzip::process() {
   }
 
   if (!CheckFreeSpaceAtPath(required_size,
-      bf::path(context_->root_application_path.get()))) {
+      fs::path(context_->root_application_path.get()))) {
     LOG(ERROR) << "There is not enough space to install application files";
     return Step::Status::OUT_OF_SPACE;
   }
@@ -94,7 +92,7 @@ Step::Status StepUnzip::process() {
   }
 
 
-  if (!ExtractToTmpDir(context_->file_path.get().string().c_str(), tmp_dir)) {
+  if (!ExtractToTmpDir(context_->file_path.get().c_str(), tmp_dir)) {
     LOG(ERROR) << "Failed to process unpack step";
     RemoveAll(tmp_dir);
     return Step::Status::UNZIP_ERROR;
@@ -107,7 +105,7 @@ Step::Status StepUnzip::process() {
 }
 
 Step::Status StepUnzip::undo() {
-  if (access(context_->unpacked_dir_path.get().string().c_str(), F_OK) == 0) {
+  if (access(context_->unpacked_dir_path.get().c_str(), F_OK) == 0) {
     RemoveAll(context_->unpacked_dir_path.get());
     LOG(DEBUG) << "remove temp dir: " << context_->unpacked_dir_path.get();
   }