_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;