return 0;
}
-static int getRootPath(std::string pkgId, std::string& rootPath)
-{
- int ret = 0;
- char *path = 0;
-
- uid_t uid = 0;
-
- if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
- _ERR("Failed to get UID");
- return -1;
- }
-
- pkgmgrinfo_pkginfo_h handle;
- if (uid == 0) {
- ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgId.c_str(), &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- } else {
- ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &handle);
- if (ret != PMINFO_R_OK)
- return -1;
- }
-
- ret = pkgmgrinfo_pkginfo_get_root_path(handle, &path);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
- return -1;
- }
- rootPath = path;
- pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
-
- return 0;
-}
-
static int appAotCb(pkgmgrinfo_appinfo_h handle, void *userData)
{
char *pkgId = NULL;
}
}
-int createNiUnderPkgRoot(const std::string& pkgName, bool enableR2R)
+int createNiUnderPkgRoot(const std::string& pkgId, bool enableR2R)
{
std::string pkgRoot;
- if (getRootPath(pkgName, pkgRoot) < 0) {
- fprintf(stderr, "Failed to get root path from [%s]\n", pkgName.c_str());
+ if (getRootPath(pkgId, pkgRoot) < 0) {
+ fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
return -1;
}
std::string binDir = concatPath(pkgRoot, "bin");
std::string libDir = concatPath(pkgRoot, "lib");
- std::string appTAC = concatPath(binDir, "TAC.Release");
+ std::string appTAC = concatPath(binDir, ".TAC.Release");
std::string paths[] = {binDir, libDir, appTAC};
createNiUnderDirs(paths, 3, enableR2R);
return 0;
}
-int createNiDllUnderPkgRoot(const std::string& pkgName, const std::string& dllPath, bool enableR2R)
+int createNiDllUnderPkgRoot(const std::string& pkgId, const std::string& dllPath, bool enableR2R)
{
std::string pkgRoot;
- if (getRootPath(pkgName, pkgRoot) < 0) {
- fprintf(stderr, "Failed to get root path from [%s]\n", pkgName.c_str());
+ if (getRootPath(pkgId, pkgRoot) < 0) {
+ fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
return -1;
}
scanFilesInDir(rootPaths[i], convert, -1);
}
-int removeNiUnderPkgRoot(const std::string& pkgName)
+int removeNiUnderPkgRoot(const std::string& pkgId)
{
std::string pkgRoot;
- if (getRootPath(pkgName, pkgRoot) < 0) {
- fprintf(stderr, "Failed to get root path from [%s]\n", pkgName.c_str());
+ if (getRootPath(pkgId, pkgRoot) < 0) {
+ fprintf(stderr, "Failed to get root path from [%s]\n", pkgId.c_str());
return -1;
}