Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / configuration / step_configure.cc
index 6608e03..7450bbb 100644 (file)
@@ -4,16 +4,17 @@
 
 #include "common/step/configuration/step_configure.h"
 
-#include <boost/filesystem/path.hpp>
-
 #include <pkgmgr-info.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
 #include <tzplatform_config.h>
 
+#include <filesystem>
 #include <memory>
+#include <optional>
 #include <string>
+#include <system_error>
 #include <utility>
 
 #include "common/utils/pkgmgr_query.h"
@@ -21,7 +22,7 @@
 #include "common/utils/user_util.h"
 #include "common/utils/request.h"
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace common_installer {
 namespace configuration {
@@ -70,7 +71,7 @@ Step::Status StepConfigure::process() {
       break;
     case RequestType::Reinstall:
       context_->unpacked_dir_path.set(
-          bf::path(tzplatform_getenv(TZ_SDK_TOOLS)) / "tmp" /
+          fs::path(tzplatform_getenv(TZ_SDK_TOOLS)) / "tmp" /
           pkgmgr_->GetRequestInfo(context_->index.get()));
       context_->pkgid.set(pkgmgr_->GetRequestInfo(context_->index.get()));
       context_->file_path.set(kStrEmpty);
@@ -109,10 +110,10 @@ Step::Status StepConfigure::process() {
           request_type == RequestType::ManifestPartialUpdate)
         SetupIsPartialRW();
       context_->pkgid.set(pkgmgr_->GetRequestInfo(context_->index.get()));
-      bf::path xml_path =
-          bf::path(getUserManifestPath(context_->uid.get(),
+      fs::path xml_path =
+          fs::path(getUserManifestPath(context_->uid.get(),
               context_->is_readonly_package.get()))
-          / bf::path(context_->pkgid.get());
+          / fs::path(context_->pkgid.get());
       xml_path += ".xml";
       context_->unpacked_dir_path.set(context_->GetPkgPath());
       context_->xml_path.set(xml_path);
@@ -129,8 +130,8 @@ Step::Status StepConfigure::process() {
     }
     case RequestType::ReadonlyUpdateUninstall: {
       context_->pkgid.set(pkgmgr_->GetRequestInfo(context_->index.get()));
-      bf::path original_path =
-          bf::path(tzplatform_getenv(TZ_SYS_RO_APP)) / context_->pkgid.get();
+      fs::path original_path =
+          fs::path(tzplatform_getenv(TZ_SYS_RO_APP)) / context_->pkgid.get();
       context_->unpacked_dir_path.set(original_path);
       context_->file_path.set(kStrEmpty);
       SetupIsKeepRWData();
@@ -180,7 +181,7 @@ Step::Status StepConfigure::precheck() {
   if (getuid() == 0)
     return Status::OK;
 
-  boost::optional<uid_t> appfw_uid = GetUidByUserName(kAppFWUser);
+  std::optional<uid_t> appfw_uid = GetUidByUserName(kAppFWUser);
   if (!appfw_uid)
     return Status::ERROR;
 
@@ -202,10 +203,9 @@ bool StepConfigure::SetupRootAppDirectory() {
 
     context_->root_application_path.set(root_app_path);
   }
-  if (!boost::filesystem::exists(context_->root_application_path.get())) {
-    boost::system::error_code error;
-    boost::filesystem::create_directories(
-        context_->root_application_path.get());
+  if (!fs::exists(context_->root_application_path.get())) {
+    std::error_code error;
+    fs::create_directories(context_->root_application_path.get());
     if (error) {
       LOG(ERROR) << "Cannot create directory: "
                  << context_->root_application_path.get();