6 #include <pkgmgr-info.h>
8 #include "pkgmgr-server.h"
10 struct manifest_and_type {
15 struct manifest_and_type type_map[] = {
16 { "res/wgt/config.xml", "wgt" },
17 { "config.xml", "wgt" },
18 { "tizen-manifest.xml", "tpk" },
22 const char *_get_pkgtype_from_file(const char *file_path)
24 const char *type = NULL;
28 uf = unzOpen(file_path);
30 ERR("failed to open zip file %s", file_path);
34 for (i = 0; type_map[i].manifest != NULL; i++) {
35 if (unzLocateFile(uf, type_map[i].manifest, 0) == UNZ_OK) {
36 DBG("pkgtype of %s: [%s]", file_path, type_map[i].type);
37 type = type_map[i].type;
47 char *_get_pkgtype_from_pkgid(const char *pkgid, uid_t uid)
51 pkgmgrinfo_pkginfo_h info;
54 ret = pkgmgrinfo_pkginfo_get_usr_all_pkginfo(pkgid, uid, &info);
55 if (ret != PMINFO_R_OK)
58 ret = pkgmgrinfo_pkginfo_get_type(info, &pkgtype);
59 if (ret != PMINFO_R_OK) {
60 pkgmgrinfo_pkginfo_destroy_pkginfo(info);
64 DBG("pkgtype of %s: [%s]", pkgid, pkgtype);
66 type = strdup(pkgtype);
67 pkgmgrinfo_pkginfo_destroy_pkginfo(info);