// 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/pkgmgr_query.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 {
+ std::error_code ec;
+ std::string pkg_id;
// argument from commandline is path to file
- std::string pkg_id = GetPkgIdFromPath(arg);
+ if (fs::exists(arg, ec) && ec.value() == 0)
+ pkg_id = GetPkgIdFromPath(arg);
if (pkg_id.empty())
pkg_id = arg;
- PkgQueryInterface pkg_query(pkg_id, uid);
+ PkgQueryInterface pkg_query(pkg_id, uid, true);
return pkg_query.IsPackageInstalled(GetRequestMode(uid));
}
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,
return tmp_path;
}
+bool AppQueryInterface::ClearTemporaryFile(
+ const fs::path& path) const {
+ return RemoveAll(path);
+}
+
} // namespace common_installer