The Pre-Compiled app skips the TAC (#444)
[platform/core/dotnet/launcher.git] / NativeLauncher / tool / tac_common.cc
index 7755565..2824a37 100644 (file)
@@ -83,8 +83,6 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
        char *pkgId = NULL;
        char *root = NULL;
        char *exec = NULL;
-       std::string rootPath;
-       std::string execName;
 
        int ret = pkgmgrinfo_appinfo_get_pkgid(handle, &pkgId);
        if (ret != PMINFO_R_OK) {
@@ -92,21 +90,21 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
                return -1;
        }
 
-       enableTACPackage(std::string(pkgId));
-
        ret = pkgmgrinfo_appinfo_get_root_path(handle, &root);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get root path");
                return -1;
        }
-       rootPath = std::string(root);
+       std::string rootPath = std::string(root);
 
        ret = pkgmgrinfo_appinfo_get_exec(handle, &exec);
        if (ret != PMINFO_R_OK) {
                _SERR("Failed to get exec name");
                return -1;
        }
-       execName = std::string(exec).substr(std::string(exec).rfind('/') + 1);
+       std::string execName = std::string(exec).substr(std::string(exec).rfind('/') + 1);
+
+       enableTACPackage(std::string(pkgId));
 
        std::vector<std::string> parserData;
        std::string binDir = concatPath(rootPath, "bin");
@@ -134,6 +132,7 @@ static int tac_restoreDBCb(pkgmgrinfo_appinfo_h handle, void *userData)
                }
        }
        parserData.clear();
+
        return 0;
 }
 
@@ -261,6 +260,12 @@ tac_error_e enableTACPackage(const std::string& pkgId)
                return TAC_ERROR_INVALID_PACKAGE;
        }
 
+       std::string binDir = concatPath(rootPath, "bin");
+       if (exist(concatPath(binDir, PRE_COMPILED_PACKAGE_FILE))) {
+               _INFO("The %s is a Pre-Compiled package. So, skip the TAC", pkgId.c_str());
+               return TAC_ERROR_NONE;
+       }
+
        std::string execName = getExecName(pkgId);
        if (execName.empty()) {
                _SERR("Failed to get exec name from [%s]", pkgId.c_str());