Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / filesystem / step_copy_tep.cc
index b79b3fb..a9fb3a3 100644 (file)
@@ -7,7 +7,9 @@
 
 #include <cassert>
 #include <cstring>
+#include <filesystem>
 #include <string>
+#include <system_error>
 
 #include "common/utils/paths.h"
 #include "common/utils/file_util.h"
@@ -15,8 +17,7 @@
 namespace common_installer {
 namespace filesystem {
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
 
 Step::Status StepCopyTep::precheck() {
   if (context_->root_application_path.get().empty()) {
@@ -24,7 +25,7 @@ Step::Status StepCopyTep::precheck() {
     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";
@@ -42,7 +43,7 @@ Step::Status StepCopyTep::precheck() {
 Step::Status StepCopyTep::process() {
   if (context_->tep_path.get().empty())
     return Step::Status::OK;
-  bf::path tep_path;
+  fs::path tep_path;
   if (context_->external_storage) {
     tep_path = GetExternalTepPath(context_->request_mode.get(),
                                   context_->uid.get());
@@ -54,9 +55,9 @@ Step::Status StepCopyTep::process() {
   // appstore uses to identify version of tep on device.
   tep_path /= context_->tep_path.get().filename();
 
-  if (!bf::exists(tep_path.parent_path())) {
-    bs::error_code error;
-    bf::create_directories(tep_path.parent_path(), error);
+  if (!fs::exists(tep_path.parent_path())) {
+    std::error_code error;
+    fs::create_directories(tep_path.parent_path(), error);
     if (error) {
       LOG(ERROR) << "Cannot create tep parent directory";
       return Status::APP_DIR_ERROR;
@@ -86,7 +87,7 @@ Step::Status StepCopyTep::undo() {
   RemoveAll(context_->tep_path.get());
   // remove tep file is installed outside package path
   if (context_->external_storage) {
-    bf::path tep_path = GetExternalTepPath(context_->request_mode.get(),
+    fs::path tep_path = GetExternalTepPath(context_->request_mode.get(),
                                            context_->uid.get());
     tep_path /= context_->tep_path.get().filename();
     RemoveAll(tep_path);