| 365 | } |
| 366 | |
| 367 | int FindFilePaths(const char* path, char* bufs, int buf_size, int num_bufs, PathFlagsBitfield flags, bool is_necessary, PathFlags* resulting_paths, ModID* sourceids) { |
| 368 | int num_paths_found = 0; |
| 369 | char* buf = bufs; |
| 370 | if (flags & kModPaths) { |
| 371 | for (int i = 0; i < mod_paths.num_paths; ++i) { |
| 372 | AssemblePath(mod_paths.paths[i], path, buf, buf_size); |
| 373 | caseCorrect(buf); |
| 374 | if (CheckFileAccess(buf)) { |
| 375 | if (resulting_paths) { |
| 376 | resulting_paths[num_paths_found] = kModPaths; |
| 377 | } |
| 378 | if (sourceids) { |
| 379 | sourceids[num_paths_found] = mod_paths.mod_path_ids[i]; |
| 380 | } |
| 381 | ++num_paths_found; |
| 382 | if (num_paths_found >= num_bufs) { |
| 383 | return num_paths_found; |
| 384 | } |
| 385 | buf += buf_size; |
| 386 | } |
| 387 | } |
| 388 | } |
| 389 | if (flags & kDataPaths) { |
| 390 | for (int i = 0; i < vanilla_data_paths.num_paths; ++i) { |
| 391 | AssemblePath(vanilla_data_paths.paths[i], path, buf, buf_size); |
| 392 | caseCorrect(buf); |
| 393 | if (CheckFileAccess(buf)) { |
| 394 | if (resulting_paths) { |
| 395 | resulting_paths[num_paths_found] = kDataPaths; |
| 396 | } |
| 397 | if (sourceids) { |
| 398 | sourceids[num_paths_found] = vanilla_data_paths.mod_path_ids[i]; |
| 399 | } |
| 400 | ++num_paths_found; |
| 401 | if (num_paths_found >= num_bufs) { |
| 402 | return num_paths_found; |
| 403 | } |
| 404 | buf += buf_size; |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | if (flags & kModWriteDirs) { |
| 409 | for (int i = 0; i < mod_paths.num_paths; ++i) { |
| 410 | string mod_write_path = GetWritePath(mod_paths.mod_path_ids[i]); |
| 411 | AssemblePath(mod_write_path.c_str(), path, buf, buf_size); |
| 412 | // Not case-correcting write dir for now, since it might interact badly with the many uses of the writedir not using FindFilePath |
| 413 | if (CheckFileAccess(buf)) { |
| 414 | if (resulting_paths) { |
| 415 | resulting_paths[num_paths_found] = kModWriteDirs; |
| 416 | } |
| 417 | if (sourceids) { |
| 418 | sourceids[num_paths_found] = mod_paths.mod_path_ids[i]; |
| 419 | } |
| 420 | ++num_paths_found; |
| 421 | if (num_paths_found >= num_bufs) { |
| 422 | return num_paths_found; |
| 423 | } |
| 424 | buf += buf_size; |
no test coverage detected