#define __XSTR(x) #x
#define __STR(x) __XSTR(x)
static const char* __CROSSGEN_PATH = __STR(CROSSGEN_PATH);
+static const char* __TAC_DIR = __STR(TAC_DIR);
#ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
static const char* __SYSTEM_BASE_FILE = __STR(SYSTEM_BASE_FILE);
return NI_ERROR_UNKNOWN;
}
- if (isAppNI) {
+ if (isAppNI && strstr(absNiPath.c_str(), __TAC_DIR) == NULL) {
absNiPath = getAppNIPath(absNiPath);
}
return status;
}
+void createNiUnderTAC(const std::string rootPaths[], int count)
+{
+ std::string appPaths;
+ try {
+ for (auto& nuget : bf::recursive_directory_iterator(__TAC_DIR)) {
+ std::string nugetPath = nuget.path().string();
+ if (bf::is_directory(nugetPath)) {
+ appPaths += nugetPath;
+ appPaths += ':';
+ }
+ }
+ if (appPaths.back() == ':') {
+ appPaths.pop_back();
+ }
+
+ auto convert = [&appPaths](const std::string& path, const char* name) {
+ if (strstr(path.c_str(), TAC_APP_LIST_DB) != NULL ||
+ strstr(path.c_str(), TAC_APP_LIST_RESTORE_DB) != NULL ||
+ strstr(path.c_str(), TAC_SHA_256_INFO) != NULL)
+ return;
+ if (!crossgen(path, appPaths.c_str(), false)) {
+ waitInterval();
+ }
+ };
+
+ for (int i = 0; i < count; i++) {
+ scanFilesInDir(rootPaths[i], convert, -1);
+ }
+ } catch (const bf::filesystem_error& error) {
+ fprintf(stderr, "Failed to recursive directory: %s", error.what());
+ return;
+ }
+}
+
void createNiUnderDirs(const std::string rootPaths[], int count, bool enableR2R, bool isAppNI)
{
createCoreLibNI(enableR2R);