| 321 | } |
| 322 | |
| 323 | void FileBankManager::ScanDir(RString dir, RString rel) |
| 324 | { |
| 325 | #ifndef _WIN32 |
| 326 | LocalPath(dirPath, dir); |
| 327 | DIR* scan = opendir(dirPath); |
| 328 | if (scan) |
| 329 | { |
| 330 | struct dirent* entry; |
| 331 | while ((entry = readdir(scan)) != nullptr) |
| 332 | { |
| 333 | const char* name = entry->d_name; |
| 334 | RString subdir = RString(dirPath) + RString(DIR_STR) + RString(name); |
| 335 | RString subrel = rel + RString(DIR_STR) + RString(name); |
| 336 | struct stat buf; |
| 337 | if (stat(subdir, &buf) < 0) |
| 338 | { |
| 339 | LOG_DEBUG(Core, "Error {}\n", (const char*)subdir); |
| 340 | continue; |
| 341 | } |
| 342 | if (buf.st_mode & S_IFDIR) |
| 343 | { |
| 344 | if (*name == '.') |
| 345 | continue; |
| 346 | ScanDir(subdir, subrel); |
| 347 | continue; |
| 348 | } |
| 349 | FileInfoExt f; |
| 350 | const char* rc = subrel; |
| 351 | if (*rc == DIR_CHR) |
| 352 | rc++; |
| 353 | f.compressedMagic = 0; |
| 354 | f.uncompressedSize = 0; |
| 355 | f.startOffset = 0; |
| 356 | f.name = CanonicalBankEntryName(rc); |
| 357 | f.length = buf.st_size; |
| 358 | f.time = buf.st_mtime; |
| 359 | if (newestFile < f.time) |
| 360 | newestFile = f.time; |
| 361 | files.Add(f); |
| 362 | } |
| 363 | } |
| 364 | #else |
| 365 | _finddata_t fInfo; |
| 366 | RString wild = RString(dir) + RString("\\*"); |
| 367 | intptr_t hFile = _findfirst(wild, &fInfo); |
| 368 | if (hFile != -1) |
| 369 | { |
| 370 | do |
| 371 | { |
| 372 | RString subrel = rel + RString(DIR_STR) + RString(fInfo.name); |
| 373 | if (fInfo.attrib & _A_SUBDIR) |
| 374 | { |
| 375 | if (fInfo.name[0] == '.') |
| 376 | { |
| 377 | continue; |
| 378 | } |
| 379 | RString subdir = dir + RString(DIR_STR) + RString(fInfo.name); |
| 380 | ScanDir(subdir, subrel); |
nothing calls this directly
no test coverage detected