namespace common_installer {
-std::unique_ptr<AppInstaller> UnifiedInstallerFactory::CreateInstaller(
- PkgMgrPtr pkgmgr, int idx) {
- std::string type = GetPkgTypeFromPkgid(pkgmgr->GetRequestInfo(idx),
- pkgmgr->GetUid());
+std::string UnifiedInstallerFactory::GetPkgType(
+ const std::string& info, uid_t uid) {
+ std::string type;
+ type = GetPkgTypeFromPkgid(info, uid);
if (type.empty())
- type = GetPkgTypeFromPath(pkgmgr->GetRequestInfo(idx));
+ type = GetPkgTypeFromPath(info);
if (type.empty())
type = GetPkgTypeFromFilename(
- boost::filesystem::path(pkgmgr->GetRequestInfo(idx)).filename());
+ boost::filesystem::path(info).filename());
+
+ return type;
+}
+
+std::unique_ptr<AppInstaller> UnifiedInstallerFactory::CreateInstaller(
+ PkgMgrPtr pkgmgr, int idx) {
+ std::string type = GetPkgType(pkgmgr->GetRequestInfo(idx),
+ pkgmgr->GetUid());
if (type.empty())
return {};
class UnifiedInstallerFactory : public InstallerFactory {
public:
std::unique_ptr<AppInstaller> CreateInstaller(PkgMgrPtr pkgmgr, int idx);
+
+ private:
+ std::string GetPkgType(const std::string& info, uid_t uid);
};
} // namespace common_installer