return;
}
-char *_get_backend_path(const char *input_path)
-{
- FILE *fp = NULL;
- char buffer[1024] = { '\0', };
- char *type = NULL;
- char installer_path[PKG_STRING_LEN_MAX] = { '\0', };
- char pkg_path[PKG_STRING_LEN_MAX] = { '\0', };
- char backend_path[PKG_STRING_LEN_MAX] = { '\0', };
-
- if (strrchr(input_path, '/')) {
- strncpy(pkg_path, strrchr(input_path, '/') + 1,
- PKG_STRING_LEN_MAX - 1);
- } else {
- strncpy(pkg_path, input_path, PKG_STRING_LEN_MAX - 1);
- }
-
- DBG("pkg_path[%s]\n", pkg_path);
-
- fp = fopen(PKG_CONF_PATH, "r");
- if (fp == NULL)
- return NULL;
-
- char *path = NULL;
- while (fgets(buffer, 1024, fp) != NULL) {
- if (buffer[0] == '#')
- continue;
-
- _app_str_trim(buffer);
-
- if ((path = strstr(buffer, PKG_BACKEND)) != NULL) {
- DBG("[%s]\n", buffer);
- DBG("[%s]\n", path);
- path = path + strlen(PKG_BACKEND);
- DBG("[%s]\n", path);
-
- break;
- }
-
- memset(buffer, 0x00, 1024);
- }
-
- if (fp != NULL)
- fclose(fp);
-
- if (path == NULL)
- return NULL;
-
-/* if(path[strlen(path)] == '/') */
- snprintf(backend_path, PKG_STRING_LEN_MAX - 1, "%s", path);
-/* else
- sprintf(backend_path, "%s/", path); */
-
- type = strrchr(pkg_path, '.');
- if (type == NULL)
- type = pkg_path;
- else
- type++;
-
- snprintf(installer_path, PKG_STRING_LEN_MAX - 1,
- "%s%s", backend_path, type);
-
- DBG("installer_path[%s]\n", installer_path);
-
- if (access(installer_path, F_OK) != 0)
- return NULL;
-
- return strdup(installer_path);
-}
-
-char *_get_backend_path_with_type(const char *type)
-{
- FILE *fp = NULL;
- char buffer[1024] = { '\0', };
- char installer_path[PKG_STRING_LEN_MAX] = { '\0', };
- char backend_path[PKG_STRING_LEN_MAX] = { '\0', };
-
- DBG("type[%s]\n", type);
-
- fp = fopen(PKG_CONF_PATH, "r");
- if (fp == NULL)
- return NULL;
-
- char *path = NULL;
- while (fgets(buffer, 1024, fp) != NULL) {
- if (buffer[0] == '#')
- continue;
-
- _app_str_trim(buffer);
-
- if ((path = strstr(buffer, PKG_BACKEND)) != NULL) {
- DBG("[%s]\n", buffer);
- DBG("[%s]\n", path);
- path = path + strlen(PKG_BACKEND);
- DBG("[%s]\n", path);
-
- break;
- }
-
- memset(buffer, 0x00, 1024);
- }
-
- if (fp != NULL)
- fclose(fp);
-
- if (path == NULL)
- return NULL;
-
-/* if(path[strlen(path)] == '/') */
- snprintf(backend_path, PKG_STRING_LEN_MAX - 1, "%s", path);
-/* else
- sprintf(backend_path, "%s/", path); */
-
- snprintf(installer_path, PKG_STRING_LEN_MAX - 1,
- "%s%s", backend_path, type);
- DBG("installer_path[%s]\n", installer_path);
-
- if (access(installer_path, F_OK) != 0) {
- char extlist[256] = { '\0', };
- _get_mime_extension(type, extlist, sizeof(extlist));
- DBG("extlist[%s]\n", extlist);
-
- if (strlen(extlist) == 0)
- return NULL;
-
- if (strchr(extlist, ',')) {
- extlist[strlen(extlist) -
- strlen(strchr(extlist, ','))] = '\0';
- }
- type = strchr(extlist, '.') + 1;
-
- snprintf(installer_path, PKG_STRING_LEN_MAX - 1,
- "%s%s", backend_path, type);
- }
-
- return strdup(installer_path);
-}
-
int _get_mime_from_file(const char *filename, char *mimetype, int len)
{
const char *mime;
return 0;
}
-const char *_get_pkg_type(const char *pkgid, uid_t uid)
-{
- int ret;
- pkgmgrinfo_pkginfo_h pkginfo;
- char *val;
- static char pkg_type[PKG_EXT_LEN_MAX];
-
- ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &pkginfo);
- if (ret != PMINFO_R_OK)
- return NULL;
-
- ret = pkgmgrinfo_pkginfo_get_type(pkginfo, &val);
- if (ret != PMINFO_R_OK)
- return NULL;
-
- snprintf(pkg_type, sizeof(pkg_type), "%s", val);
-
- pkgmgrinfo_pkginfo_destroy_pkginfo(pkginfo);
-
- return pkg_type;
-}
-
package_manager_pkg_info_t *_pkg_malloc_appinfo(int num)
{
package_manager_app_info_t *app_info = NULL;