Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / step / security / step_recover_signature.cc
index e53b1e0..e0b63bb 100644 (file)
@@ -4,36 +4,35 @@
 
 #include "common/step/security/step_recover_signature.h"
 
-#include <boost/filesystem/path.hpp>
-
+#include <filesystem>
 #include <string>
 
 #include "common/certificate_validation.h"
 #include "common/utils/file_util.h"
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace {
 
-bf::path GetSignatureFilePath(bool is_readonly) {
-  return bf::path((is_readonly) ?
+fs::path GetSignatureFilePath(bool is_readonly) {
+  return fs::path((is_readonly) ?
       tzplatform_getenv(TZ_SYS_RO_SHARE) : tzplatform_getenv(TZ_SYS_SHARE)) /
           "signatures";
 }
 
 bool RemoveSignatureBackup(const std::string& pkgid, bool is_readonly) {
-  bf::path path = GetSignatureFilePath(is_readonly);
-  bf::path backup_path = bf::path(path) / std::string(pkgid + "_backup.txt");
+  fs::path path = GetSignatureFilePath(is_readonly);
+  fs::path backup_path = fs::path(path) / std::string(pkgid + "_backup.txt");
 
   return common_installer::Remove(backup_path);
 }
 
 bool RecoverSignatureFile(const std::string& pkgid, bool is_readonly) {
-  bf::path path = GetSignatureFilePath(is_readonly);
-  bf::path target_path = bf::path(path) / std::string(pkgid + ".txt");
-  bf::path backup_path = bf::path(path) / std::string(pkgid + "_backup.txt");
+  fs::path path = GetSignatureFilePath(is_readonly);
+  fs::path target_path = fs::path(path) / std::string(pkgid + ".txt");
+  fs::path backup_path = fs::path(path) / std::string(pkgid + "_backup.txt");
 
-  if (bf::exists(backup_path) &&
+  if (fs::exists(backup_path) &&
       !common_installer::MoveFile(backup_path, target_path, true))
     return false;
 
@@ -46,7 +45,7 @@ namespace common_installer {
 namespace security {
 
 Step::Status StepRecoverSignature::RecoveryNew() {
-  bf::path path = GetSignatureFilePath(context_->is_readonly_package.get());
+  fs::path path = GetSignatureFilePath(context_->is_readonly_package.get());
   path /= std::string(context_->pkgid.get() + ".txt");
   if (!common_installer::Remove(path))
     return Status::CERT_ERROR;