MCPcopy Create free account
hub / github.com/TurningWheel/Barony / readAllScripts

Method readAllScripts

src/mod_tools.cpp:7528–7559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7526}
7527
7528void 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
7561bool ScriptTextParser_t::readFromFile(const std::string& filename)
7562{

Callers 2

initGameDatafilesFunction · 0.80
consolecommand.cppFile · 0.80

Calls 3

c_strMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected