}
}
+static void removeAppNITmpPath(NIOption* opt)
+{
+ std::string niTmpPath = __pm->getAppRootPath() + "/bin/" + APP_NI_SUB_TMP_DIR;
+
+ if (opt->flags & NI_FLAGS_APP_UNDER_RO_AREA) {
+ niTmpPath = replaceAll(niTmpPath, getBaseName(__pm->getAppRootPath()), __READ_ONLY_APP_UPDATE_DIR);
+ }
+
+ if (isDirectory(niTmpPath)) {
+ removeAll(niTmpPath);
+ }
+}
+
static ni_error_e doAOTList(std::vector<std::string>& dllList, const std::string& refPaths, NIOption* opt)
{
ni_error_e ret = NI_ERROR_NONE;
}
}
- if (ret == NI_ERROR_NONE) {
- if (opt->flags & NI_FLAGS_INPUT_BUBBLE) {
- for (auto &dll : dllList) {
- std::string tmpFile;
- std::string niFile = getNIFilePath(dll, opt);
- tmpFile = niFile + ".tmp";
-
- if (exist(tmpFile)) {
- moveFile(tmpFile, niFile);
- _SOUT("Native image %s generated successfully.", niFile.c_str());
- }
+ if (ret != NI_ERROR_NONE) {
+ for (auto &dll : dllList) {
+ std::string niFile1 = getNIFilePath(dll, opt);
+ std::string niFile2 = replaceAll(niFile1, "/.native_image_tmp/", "/");
+ if (opt->flags & NI_FLAGS_INPUT_BUBBLE) {
+ removeFile(niFile1 + ".tmp");
+ removeFile(niFile2 + ".tmp");
+ } else {
+ removeFile(niFile1);
+ removeFile(niFile2);
}
}
+
if (opt->flags & NI_FLAGS_APPNI) {
- renameAppNITmpPath(opt);
+ removeAppNITmpPath(opt);
+ }
+ return ret;
+ }
+
+ if (opt->flags & NI_FLAGS_INPUT_BUBBLE) {
+ for (auto &dll : dllList) {
+ std::string tmpFile;
+ std::string niFile = getNIFilePath(dll, opt);
+ tmpFile = niFile + ".tmp";
+
+ if (exist(tmpFile)) {
+ moveFile(tmpFile, niFile);
+ _SOUT("Native image %s generated successfully.", niFile.c_str());
+ }
}
}
+ if (opt->flags & NI_FLAGS_APPNI) {
+ renameAppNITmpPath(opt);
+ }
+
return ret;
}
_SERR("Failed to remove app ni dir [%s]", path.c_str());
}
}
+ std::string niTmpPath = replaceAll(path, "/.native_image", "/.native_image_tmp");
+ if (isDirectory(niTmpPath)) {
+ removeAll(niTmpPath);
+ }
}
}
}