Modified to check extensions when deleting native image files
authorj-h.choi <j-h.choi@samsung.com>
Wed, 8 Jan 2025 08:22:23 +0000 (17:22 +0900)
committer조웅석/MDE Lab(SR)/삼성전자 <ws77.cho@samsung.com>
Tue, 14 Jan 2025 00:10:37 +0000 (09:10 +0900)
Change-Id: Ia4442d953a3c27db3679c5d20be108a208669551

NativeLauncher/tool/ni_common.cc

index 3754715ba317d88d35006f1fcf57a0521eca2242..4d2e3d297da46f3b25d38c884dd775293c6885db 100644 (file)
@@ -1183,7 +1183,8 @@ void removeNIPlatform()
 void removeNIUnderDirs(const std::string& rootPaths)
 {
        auto convert = [](const std::string& path, const std::string& filename) {
-               if (isR2RImage(path)) {
+               //The .ni.dll file can be renamed .dll.
+               if (isR2RImage(path) && isNativeImage(path)) {
                        std::string assemblyPath = changeExtension(path, ".ni.dll", ".dll");
                        if (exist(assemblyPath)) {
                                if (remove(path.c_str())) {
@@ -1205,7 +1206,8 @@ void removeNIUnderDirs(const std::string& rootPaths)
 static void removeNIUnderTAC(const std::string& rootPaths)
 {
        auto convert = [&rootPaths](const std::string& path, const std::string& filename) {
-               if (isNativeImage(path)) {
+               //The .ni.dll file can be renamed .dll.
+               if (isR2RImage(path) && isNativeImage(path)) {
                        std::string assemblyPath = changeExtension(path, ".ni.dll", ".dll");
                        if (exist(assemblyPath)) {
                                if (removeFile(assemblyPath)) {