Recreate TAC folder after deleting empty folder where assembly does not exist (#627) accepted/tizen_unified_x accepted/tizen/unified/20250604.100251 accepted/tizen/unified/x/20250604.211354
author최종헌/MDE Lab(SR)/삼성전자 <j-h.choi@samsung.com>
Wed, 28 May 2025 08:18:35 +0000 (17:18 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 28 May 2025 08:18:35 +0000 (17:18 +0900)
Change-Id: I70c6235067c5eacc8672afd8c434b0d7e1be640f

NativeLauncher/tool/tac_installer.cc

index 675269a3daac5506128f0dc4d6ce12c83a4cb487..855ab5eadaa7ab5a514fca58e8d11f0df1eeef5c 100644 (file)
@@ -291,13 +291,33 @@ static int generateTAC(TACInfo& tacInfo, const std::string& pkgId, const std::st
                _INFO("TAC name : %s", tac_name.c_str());
                _INFO("TAC version : %s", tac_version.c_str());
 
-               bs::error_code error;
                std::string tac_version_dir = concatPath(tacInfo.tacLocation, np);
                std::string sha256_info = concatPath(tac_version_dir, TAC_SHA_256_INFO);
                bool isCreateTacDir = false;
-               if (!exist(tac_version_dir)) {
+               bool isTacExist = false;
+               if (exist(tac_version_dir)) {
+                       try {
+                               for (auto& file : bf::recursive_directory_iterator(tac_version_dir)) {
+                                       std::string filePath = file.path().string();
+                                       if (isNativeImage(filePath)) {
+                                               continue;
+                                       }
+                                       if (isManagedAssembly(filePath)) {
+                                               isTacExist = true;
+                                       }
+                               }
+                       } catch (const bf::filesystem_error& error) {
+                               _ERR("Failed to recursive directory: %s", error.what());
+                               isTacExist = true;
+                       }
+               }
+
+               if (!isTacExist) {
                        _INFO("Create tac_version_dir [%s]", tac_version_dir.c_str());
 
+                       //Recreate TAC folder after deleting empty folder where assembly does not exist
+                       removeAll(tac_version_dir);
+
                        if (!createDir(tac_version_dir)) {
                                _ERR("Cannot create directory: %s", tac_version_dir.c_str());
                                tacInfo.tacState = TAC_STATE_RESTORE;