Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / security / step_revoke_trust_anchor.cc
index bf299c7..85d5a17 100644 (file)
@@ -5,8 +5,8 @@
 #include "common/step/security/step_revoke_trust_anchor.h"
 
 #include <trust-anchor.h>
-#include <boost/filesystem.hpp>
 
+#include <filesystem>
 #include <string>
 
 #include "common/utils/file_util.h"
@@ -14,7 +14,7 @@
 namespace common_installer {
 namespace security {
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace {
 
@@ -34,16 +34,16 @@ Step::Status StepRevokeTrustAnchor::undo() {
   if (!manifest->use_system_certs)
     return Step::Status::OK;
 
-  bf::path pkg_certs_path = context_->GetPkgPath() / kTpkTrustAnchorPath;
+  fs::path pkg_certs_path = context_->GetPkgPath() / kTpkTrustAnchorPath;
   if (!context_->pkg_type.get().compare(kWgt)) {
     // For wgt package,
     // create [pkg_root]/res/.trust-anchor directory and create symbolic link
-    if (bf::exists(pkg_certs_path)) {
-      for (bf::directory_iterator file(pkg_certs_path);
-          file != bf::directory_iterator(); ++file) {
-        bf::path current(file->path());
-        if (bf::is_symlink(symlink_status(current))) {
-          if (!bf::remove(current)) {
+    if (fs::exists(pkg_certs_path)) {
+      for (fs::directory_iterator file(pkg_certs_path);
+          file != fs::directory_iterator(); ++file) {
+        fs::path current(file->path());
+        if (fs::is_symlink(symlink_status(current))) {
+          if (!fs::remove(current)) {
             LOG(ERROR) << "Failed to remove previous symlink : " << current;
             return Step::Status::APP_DIR_ERROR;
           }
@@ -54,14 +54,14 @@ Step::Status StepRevokeTrustAnchor::undo() {
         return Step::Status::APP_DIR_ERROR;
     }
 
-    bf::path pkg_certs_src_path =
+    fs::path pkg_certs_src_path =
         context_->GetPkgPath() / "res/wgt" / kWgtTrustAnchorPath;
-    for (bf::directory_iterator file(pkg_certs_src_path);
-        file != bf::directory_iterator(); ++file) {
-      bf::path current(file->path());
+    for (fs::directory_iterator file(pkg_certs_src_path);
+        file != fs::directory_iterator(); ++file) {
+      fs::path current(file->path());
       try {
-        bf::create_symlink(current, pkg_certs_path / current.filename());
-      } catch (const bf::filesystem_error& error) {
+        fs::create_symlink(current, pkg_certs_path / current.filename());
+      } catch (const fs::filesystem_error& error) {
         LOG(ERROR) << "Failed to make trust anchor symlink : " << error.what();
         return Step::Status::APP_DIR_ERROR;
       }
@@ -69,7 +69,7 @@ Step::Status StepRevokeTrustAnchor::undo() {
   }
 
   int ret = trust_anchor_install(context_->pkgid.get().c_str(),
-      context_->uid.get(), pkg_certs_path.string().c_str(),
+      context_->uid.get(), pkg_certs_path.c_str(),
       (strcasecmp(manifest->use_system_certs, "true") == 0) ? true : false);
 
   if (ret != TRUST_ANCHOR_ERROR_NONE) {