return NI_ERROR_NONE;
}
+static void renameAppNITmpPath(NIOption* opt)
+{
+ std::string niTmpPath = __pm->getAppRootPath() + "/bin/" + APP_NI_SUB_TMP_DIR;
+ std::string niPath = __pm->getAppRootPath() + "/bin/" + APP_NI_SUB_DIR;
+
+ if (opt->flags & NI_FLAGS_APP_UNDER_RO_AREA) {
+ niTmpPath = replaceAll(niTmpPath, getBaseName(__pm->getAppRootPath()), __READ_ONLY_APP_UPDATE_DIR);
+ niPath = replaceAll(niPath, getBaseName(__pm->getAppRootPath()), __READ_ONLY_APP_UPDATE_DIR);
+ }
+
+ if (isDirectory(niTmpPath)) {
+ if (rename(niTmpPath.c_str(), niPath.c_str())) {
+ _SERR("Fail to rename from .native_image_tmp to .native_image");
+ }
+ }
+}
+
static ni_error_e doAOTList(std::vector<std::string>& dllList, const std::string& refPaths, NIOption* opt)
{
ni_error_e ret = NI_ERROR_NONE;
}
}
if (opt->flags & NI_FLAGS_APPNI) {
- for (const auto &path : paths) {
- if (path.find("/bin") != std::string::npos) {
- rename(concatPath(path, APP_NI_SUB_TMP_DIR).c_str(), concatPath(path, APP_NI_SUB_DIR).c_str());
- break;
- }
- }
+ renameAppNITmpPath(opt);
}
}