Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / security / step_signature.cc
index 3a63882..65578e1 100644 (file)
@@ -13,7 +13,7 @@
 #include "common/certificate_validation.h"
 #include "common/utils/file_util.h"
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 namespace ci = common_installer;
 
 namespace {
@@ -51,7 +51,7 @@ Step::Status StepSignature::precheck() {
     LOG(ERROR) << "unpacked_dir_path attribute is empty";
     return Step::Status::INVALID_VALUE;
   }
-  if (!boost::filesystem::exists(context_->unpacked_dir_path.get())) {
+  if (!std::filesystem::exists(context_->unpacked_dir_path.get())) {
     LOG(ERROR) << "unpacked_dir_path ("
                << context_->unpacked_dir_path.get()
                << ") path does not exist";
@@ -64,7 +64,7 @@ Step::Status StepSignature::precheck() {
   return Step::Status::OK;
 }
 
-boost::filesystem::path StepSignature::GetSignatureRoot() const {
+std::filesystem::path StepSignature::GetSignatureRoot() const {
   return context_->unpacked_dir_path.get();
 }
 
@@ -76,7 +76,7 @@ Step::Status StepSignature::CheckPrivilegeLevel(PrivilegeLevel level) {
         context_->manifest_data.get()->privileges, &error_message)) {
       if (!error_message.empty()) {
         LOG(ERROR) << "error_message: " << error_message;
-        on_error(Status::SIGNATURE_ERROR, error_message);
+        on_error_->on_error(Status::SIGNATURE_ERROR, error_message);
       }
       return Status::SIGNATURE_ERROR;
     }
@@ -95,13 +95,13 @@ Step::Status StepSignature::process() {
   std::string error_message;
   if (!signature_->GetPrivilegeLevel(GetSignatureRoot(),
       &level, &error_message)) {
-    on_error(Status::CERT_ERROR, error_message);
+    on_error_->on_error(Status::CERT_ERROR, error_message);
     return Status::CERT_ERROR;
   }
 
   if (level == PrivilegeLevel::UNTRUSTED) {
     error_message = "Unsigned applications can not be installed";
-    on_error(Status::SIGNATURE_ERROR, error_message);
+    on_error_->on_error(Status::SIGNATURE_ERROR, error_message);
     return Status::SIGNATURE_ERROR;
   }
 
@@ -118,7 +118,7 @@ Step::Status StepSignature::process() {
                                           &error_message)) {
     if (!error_message.empty()) {
       LOG(ERROR) << "error_message: " << error_message;
-      on_error(Status::SIGNATURE_ERROR, error_message);
+      on_error_->on_error(Status::SIGNATURE_ERROR, error_message);
     }
     return Status::SIGNATURE_ERROR;
   }
@@ -135,9 +135,9 @@ Step::Status StepSignature::undo() {
   if (signature_ == nullptr)
     return Step::Status::OK;
 
-  bf::remove(signature_->GetFilePath());
-  if (bf::exists(signature_->GetBackupPath()))
-    bf::rename(signature_->GetBackupPath(), signature_->GetFilePath());
+  fs::remove(signature_->GetFilePath());
+  if (fs::exists(signature_->GetBackupPath()))
+    fs::rename(signature_->GetBackupPath(), signature_->GetFilePath());
 
   return Step::Status::OK;
 }