From: Woongsuk Date: Thu, 17 Apr 2025 00:22:16 +0000 (+0900) Subject: Move RPK check code X-Git-Tag: accepted/tizen/unified/20250428.091730^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ea36001b1278f1081145ec2f1e83b7c86809a88;p=platform%2Fcore%2Fdotnet%2Flauncher.git Move RPK check code The createNIUnderPkgRootWithPath() function can be called out-side. So, RPK checking code should be don in it. --- diff --git a/NativeLauncher/inc/ni_common.h b/NativeLauncher/inc/ni_common.h index e0f04bf..d387f8f 100644 --- a/NativeLauncher/inc/ni_common.h +++ b/NativeLauncher/inc/ni_common.h @@ -42,6 +42,7 @@ #define NI_FLAGS_RM_ORIGIN_AFTER_NI 0x0800 #define NI_FLAGS_SET_PRIORITY 0x1000 #define NI_FLAGS_PARALLELISM 0x2000 +#define NI_FLAGS_RPK 0x4000 typedef std::function afterCreate; @@ -65,7 +66,6 @@ typedef struct NIOption{ std::vector mibcPath; int priority; std::string threadNum; - bool isRPK = false; } NIOption; /** diff --git a/NativeLauncher/tool/ni_common.cc b/NativeLauncher/tool/ni_common.cc index ca659ce..0568927 100644 --- a/NativeLauncher/tool/ni_common.cc +++ b/NativeLauncher/tool/ni_common.cc @@ -738,7 +738,9 @@ static void swapExtensionRpkFiles(std::vector& paths, NIOption* opt } for (auto& dll : dllList) { - rename(dll.c_str(), changeExtension(dll, ".dll", ".dll.backup").c_str()); + if (rename(dll.c_str(), changeExtension(dll, ".dll", ".dll.backup").c_str())) { + _SERR("Failed to rename from %s to backup file", dll.c_str()); + } } for (auto& ni : niList) { std::string dll = changeExtension(ni, ".ni.dll", ".dll"); @@ -862,7 +864,7 @@ static ni_error_e doAOTList(std::vector& dllList, const std::string renameAppNITmpPath(opt); } - if (opt->isRPK) { + if (opt->flags & NI_FLAGS_RPK) { swapExtensionRpkFiles(paths, opt); } @@ -1130,7 +1132,6 @@ ni_error_e createNIUnderPkgRoot(const std::string& pkgId, NIOption* opt) _SERR("Failed to get root path from [%s]", pkgId.c_str()); return NI_ERROR_INVALID_PACKAGE; } - opt->isRPK = isRPK(pkgId); return createNIUnderPkgRootWithPath(rootPath, opt); } @@ -1156,8 +1157,15 @@ ni_error_e createNIUnderPkgRootWithPath(const std::string& rootPath, NIOption* o splitPath(extraDllPaths, opt->extraRefPath); } + std::string pkgId = getPkgId(rootPath); + if (!pkgId.empty()) { + if (isRPK(pkgId)) { + opt->flags |= NI_FLAGS_RPK; + } + } + std::string targetDirs; - if (opt->isRPK) { + if (opt->flags & NI_FLAGS_RPK) { opt->flags &= ~NI_FLAGS_APPNI; // added to exclude logic of APP_NI opt->flags |= NI_FLAGS_NO_PIPELINE; // added the flag to set the output path