1 // Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
2 // Use of this source code is governed by an apache-2.0 license that can be
3 // found in the LICENSE file.
5 #include "common/app_query_interface.h"
6 #include "common/pkgmgr_query.h"
7 #include "common/utils/file_util.h"
9 namespace bf = boost::filesystem;
10 namespace bs = boost::system;
12 namespace common_installer {
14 bool AppQueryInterface::IsPkgInstalled(const std::string& arg,
18 // argument from commandline is path to file
19 if (bf::exists(arg, ec) && ec == 0)
20 pkg_id = GetPkgIdFromPath(arg);
23 PkgQueryInterface pkg_query(pkg_id, uid);
24 return pkg_query.IsPackageInstalled(GetRequestMode(uid));
27 std::string AppQueryInterface::GetPkgId(const std::string& arg) const {
28 return GetPkgIdFromPath(arg);
31 boost::filesystem::path AppQueryInterface::ExtractManifest(
32 const std::string& from) const {
33 if (!bf::exists(from))
35 bf::path tmp_path = GenerateTmpDir("/tmp");
37 bf::create_directories(tmp_path, code);
40 if (!ExtractToTmpDir(from.c_str(), tmp_path,
41 GetManifestFileName())) {
48 } // namespace common_installer