Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / external_storage.cc
index a70c101..ca06d47 100644 (file)
@@ -8,11 +8,13 @@
 
 #include <manifest_parser/utils/logging.h>
 
+#include <filesystem>
+
 #include "common/utils/byte_size_literals.h"
 #include "common/utils/file_util.h"
 #include "common/utils/request.h"
 
-namespace bf = boost::filesystem;
+namespace fs = std::filesystem;
 
 namespace {
 
@@ -43,7 +45,7 @@ namespace common_installer {
 
 ExternalStorage::ExternalStorage(RequestType type,
     const std::string& pkgid, const std::string& package_type,
-    const boost::filesystem::path& application_root, uid_t uid)
+    const fs::path& application_root, uid_t uid)
     : type_(type),
       pkgid_(pkgid),
       package_type_(package_type),
@@ -59,7 +61,7 @@ ExternalStorage::ExternalStorage(RequestType type,
 
 ExternalStorage::ExternalStorage(RequestType type,
     const std::string& pkgid, const std::string& package_type,
-    const boost::filesystem::path& application_root, uid_t uid,
+    const fs::path& application_root, uid_t uid,
     bool is_external_move)
     : type_(type),
       pkgid_(pkgid),
@@ -134,15 +136,15 @@ const std::vector<std::string>& ExternalStorage::external_dirs() const {
 }
 
 bool ExternalStorage::Initialize(
-    const boost::filesystem::path& space_requirement) {
+    const fs::path& space_requirement) {
   // external size in MB, set any-non zero size as default
   int external_size = 1;
 
   if (!space_requirement.empty()) {
     if (package_type_ != kWgtType) {
       for (auto& dir : kExternalDirsForTpk) {
-        bf::path requirement = space_requirement / dir;
-        if (!bf::exists(requirement))
+        fs::path requirement = space_requirement / dir;
+        if (!fs::exists(requirement))
           continue;
         external_size +=
             SizeInMB(GetDirectorySize(requirement));
@@ -229,7 +231,7 @@ bool ExternalStorage::Initialize(
 }
 
 std::unique_ptr<ExternalStorage> ExternalStorage::MoveInstalledStorage(
-    RequestType type, const boost::filesystem::path& application_root,
+    RequestType type, const fs::path& application_root,
     const std::string& pkgid, const std::string& package_type,
     uid_t uid, bool is_external_move) {
 
@@ -245,9 +247,9 @@ std::unique_ptr<ExternalStorage> ExternalStorage::MoveInstalledStorage(
 }
 
 std::unique_ptr<ExternalStorage> ExternalStorage::AcquireExternalStorage(
-    RequestType type, const boost::filesystem::path& application_root,
+    RequestType type, const fs::path& application_root,
     const std::string& pkgid, const std::string& package_type,
-    const boost::filesystem::path& space_requirement,
+    const fs::path& space_requirement,
     uid_t uid) {
   std::unique_ptr<ExternalStorage> external_storage(
       new ExternalStorage(type, pkgid, package_type, application_root, uid));
@@ -262,7 +264,7 @@ std::unique_ptr<ExternalStorage> ExternalStorage::MigrateExternalStorage(
     RequestType type, const std::string& pkgid, uid_t uid) {
   std::unique_ptr<ExternalStorage> external_storage(
       new ExternalStorage(type, pkgid, uid));
-  bf::path empty_path("");
+  fs::path empty_path("");
   if (!external_storage->Initialize(empty_path)) {
     LOG(WARNING) << "Cannot initialize external storage for request";
     return nullptr;