+
+ if (nuget_restoration) {
+ for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
+ std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind(':'));
+ std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind(':'));
+ std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind(':') + 1);
+ if (!strcmp(nuget_package.c_str(), nugetPackage.c_str())) {
+ copyFile(concatPath(tac_version_dir, assembly), concatPath(binPath, assembly));
+ copySmackAndOwnership(binPath, concatPath(binPath, assembly));
+ removeFile(concatPath(tacDir, assembly));
+ }
+ }
+ }
+
+ return nuget_restoration;
+}
+
+static void copyLibraryCreateSymlink(const char* pkgId, std::vector<std::string> LibrariesInfo, std::string tlcDir)
+{
+ if (LibrariesInfo.empty()) {
+ return;
+ }
+
+ for (auto& librarySha : LibrariesInfo) {
+ std::string library = librarySha.substr(0, librarySha.find(':'));
+ std::string filename = library.substr(library.rfind('/') + 1);
+ std::string fileSha = filename + ".." + librarySha.substr(librarySha.find(':') + 1);
+ bool fileCopied = false;
+ if (!exist(concatPath(tlcDir, fileSha))) {
+ if (!copyFile(library, concatPath(tlcDir, fileSha))) {
+ _ERR("Failed to copy of %s", filename.c_str());
+ continue;
+ }
+ fileCopied = true;
+ createLibraries.push_back(concatPath(tlcDir, fileSha));
+ }
+ if (!removeFile(library)) {
+ _ERR("Failed to remove of %s", library.c_str());
+ if (fileCopied) {
+ removeFile(concatPath(tlcDir, fileSha));
+ }
+ continue;
+ }
+ bf::create_symlink(concatPath(tlcDir, fileSha), library);
+ copySmackAndOwnership(getBaseName(library), library, true);
+
+ char *sql = sqlite3_mprintf("INSERT INTO TLC (PKGID, LIBRARY) VALUES (%Q, %Q);", pkgId, fileSha.c_str());
+ if (!insertDB(tlc_db, sql)) {
+ _ERR("Sqlite insert error");
+ sqlite3_free(sql);
+ copyFile(concatPath(tlcDir, fileSha), library);
+ copySmackAndOwnership(getBaseName(library), library);
+ if (fileCopied) {
+ removeFile(concatPath(tlcDir, fileSha));
+ }
+ continue;
+ }
+ sqlite3_free(sql);
+ }