Remove boost dependency
[platform/core/appfw/app-installers.git] / src / common / app_query_interface.cc
index 4f36950..3523fcb 100644 (file)
@@ -2,21 +2,22 @@
 // Use of this source code is governed by an apache-2.0 license that can be
 // found in the LICENSE file.
 
+#include <filesystem>
+
 #include "common/app_query_interface.h"
 #include "common/utils/pkgmgr_query.h"
 #include "common/utils/file_util.h"
 
-namespace bf = boost::filesystem;
-namespace bs = boost::system;
+namespace fs = std::filesystem;
 
 namespace common_installer {
 
 bool AppQueryInterface::IsPkgInstalled(const std::string& arg,
     uid_t uid) const {
-  bs::error_code ec;
+  std::error_code ec;
   std::string pkg_id;
   // argument from commandline is path to file
-  if (bf::exists(arg, ec) && ec.value() == boost::system::errc::success)
+  if (fs::exists(arg, ec) && ec.value() == 0)
     pkg_id = GetPkgIdFromPath(arg);
   if (pkg_id.empty())
     pkg_id = arg;
@@ -28,13 +29,13 @@ std::string AppQueryInterface::GetPkgId(const std::string& arg) const {
   return GetPkgIdFromPath(arg);
 }
 
-boost::filesystem::path AppQueryInterface::ExtractManifest(
+fs::path AppQueryInterface::ExtractManifest(
     const std::string& from) const {
-  if (!bf::exists(from))
+  if (!fs::exists(from))
     return {};
-  bf::path tmp_path = GenerateTmpDir("/tmp");
-  bs::error_code code;
-  bf::create_directories(tmp_path, code);
+  fs::path tmp_path = GenerateTmpDir("/tmp");
+  std::error_code code;
+  fs::create_directories(tmp_path, code);
   if (code)
     return {};
   if (!ExtractToTmpDir(from.c_str(), tmp_path,
@@ -46,7 +47,7 @@ boost::filesystem::path AppQueryInterface::ExtractManifest(
 }
 
 bool AppQueryInterface::ClearTemporaryFile(
-    const boost::filesystem::path& path) const {
+    const fs::path& path) const {
   return RemoveAll(path);
 }