| 7526 | } |
| 7527 | |
| 7528 | void ScriptTextParser_t::readAllScripts() |
| 7529 | { |
| 7530 | allEntries.clear(); |
| 7531 | |
| 7532 | std::string baseDir = "/data/scripts"; |
| 7533 | auto files = physfsGetFileNamesInDirectory(baseDir.c_str()); |
| 7534 | for ( auto& file : files ) |
| 7535 | { |
| 7536 | std::string checkFile = baseDir + '/' + file; |
| 7537 | PHYSFS_Stat stat; |
| 7538 | if ( PHYSFS_stat(checkFile.c_str(), &stat) == 0 ) { continue; } |
| 7539 | |
| 7540 | if ( stat.filetype == PHYSFS_FileType::PHYSFS_FILETYPE_DIRECTORY ) |
| 7541 | { |
| 7542 | auto files2 = physfsGetFileNamesInDirectory(checkFile.c_str()); |
| 7543 | for ( auto& file2 : files2 ) |
| 7544 | { |
| 7545 | std::string checkFile2 = checkFile + '/' + file2; |
| 7546 | if ( PHYSFS_stat(checkFile2.c_str(), &stat) == 0 ) { continue; } |
| 7547 | |
| 7548 | if ( stat.filetype != PHYSFS_FileType::PHYSFS_FILETYPE_DIRECTORY ) |
| 7549 | { |
| 7550 | readFromFile(checkFile2); |
| 7551 | } |
| 7552 | } |
| 7553 | } |
| 7554 | else |
| 7555 | { |
| 7556 | readFromFile(checkFile); |
| 7557 | } |
| 7558 | } |
| 7559 | } |
| 7560 | |
| 7561 | bool ScriptTextParser_t::readFromFile(const std::string& filename) |
| 7562 | { |
no test coverage detected