#include <unzip.h>
+#include <boost/filesystem/path.hpp>
+
#include <manifest_parser/utils/logging.h>
#include <hybrid/hybrid_installer.h>
#include <tpk/tpk_app_query_interface.h>
return type;
}
+std::string GetPkgTypeFromFilename(const boost::filesystem::path& name) {
+ std::string filename = name.string();
+ std::string token;
+ std::stringstream ss(filename);
+
+ std::getline(ss, token, '-');
+ return token;
+}
+
} // namespace
namespace common_installer {
PkgMgrPtr pkgmgr, int idx) {
std::string type = GetPkgTypeFromPkgid(pkgmgr->GetRequestInfo(idx),
pkgmgr->GetUid());
+
if (type.empty())
type = GetPkgTypeFromPath(pkgmgr->GetRequestInfo(idx));
+ if (type.empty())
+ type = GetPkgTypeFromFilename(
+ boost::filesystem::path(pkgmgr->GetRequestInfo(idx)).filename());
+
if (type.empty())
return {};