| 334 | } |
| 335 | |
| 336 | bool getFilePath(const char *fileName, FilePath *outPath) |
| 337 | { |
| 338 | char fullname[TFE_MAX_PATH]; |
| 339 | |
| 340 | outPath->archive = nullptr; |
| 341 | outPath->index = INVALID_FILE; |
| 342 | outPath->path[0] = 0; |
| 343 | |
| 344 | // Search for any filemappings. |
| 345 | // This is usually only used with mods and usually limited to 0-3 files. |
| 346 | for (auto it = s_fileMappings.begin(); it != s_fileMappings.end(); it++) { |
| 347 | if (0 == strcasecmp(it->fileName.c_str(), fileName)) { |
| 348 | strcpy(outPath->path, it->realPath.c_str()); |
| 349 | return true; |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | // Search in the local search paths before local archives: s_searchPaths. |
| 354 | for (auto it = s_searchPaths.begin(); it != s_searchPaths.end(); it++) { |
| 355 | sprintf(fullname, "%s%s", it->c_str(), fileName); |
| 356 | if (FileUtil::existsNoCase(fullname)) { |
| 357 | strncpy(outPath->path, fullname, TFE_MAX_PATH); |
| 358 | return true; |
| 359 | } |
| 360 | } |
| 361 | |
| 362 | // Then archives: s_localArchives. |
| 363 | for (auto it = s_localArchives.begin(); it != s_localArchives.end(); it++) { |
| 364 | u32 index = (*it)->getFileIndex(fileName); |
| 365 | if (index != INVALID_FILE) { |
| 366 | outPath->archive = *it; |
| 367 | outPath->index = index; |
| 368 | return true; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // Finally admit defeat. |
| 373 | return false; |
| 374 | } |
| 375 | |
| 376 | // Return true if we want to use a "portable" install - |
| 377 | // aka all data such as screenshots, settings, etc. are stored in the |
nothing calls this directly
no test coverage detected