@@ -1006,38 +1006,30 @@ VxCoreError BundledFolderManager::CopyFile(const std::string &src_file_path,
10061006
10071007void BundledFolderManager::IterateAllFiles (
10081008 std::function<bool (const std::string &, const FileRecord &)> callback) {
1009- std::vector<std::string> folder_paths;
1010-
1011- std::function<void (const std::string &)> collect_folders = [&](const std::string &fp) {
1012- folder_paths.push_back (fp);
1013-
1009+ std::function<bool (const std::string &)> iterate_folder = [&](const std::string &fp) {
10141010 FolderConfig *config = nullptr ;
10151011 VxCoreError error = GetFolderConfig (fp, &config);
10161012 if (error != VXCORE_OK) {
1017- return ;
1013+ return true ;
1014+ }
1015+
1016+ for (const auto &file : config->files ) {
1017+ if (!callback (fp, file)) {
1018+ return false ;
1019+ }
10181020 }
10191021
10201022 for (const auto &folder_name : config->folders ) {
10211023 std::string child_path = fp.empty () ? folder_name : fp + " /" + folder_name;
1022- collect_folders (child_path);
1024+ if (!iterate_folder (child_path)) {
1025+ return false ;
1026+ }
10231027 }
1024- };
1025-
1026- collect_folders (" " );
10271028
1028- for (const auto &fp : folder_paths) {
1029- FolderConfig *config = nullptr ;
1030- VxCoreError error = GetFolderConfig (fp, &config);
1031- if (error != VXCORE_OK) {
1032- continue ;
1033- }
1029+ return true ;
1030+ };
10341031
1035- for (const auto &file : config->files ) {
1036- if (!callback (fp, file)) {
1037- return ;
1038- }
1039- }
1040- }
1032+ iterate_folder (" ." );
10411033}
10421034
10431035VxCoreError BundledFolderManager::FindFilesByTag (const std::string &tag_name,
0 commit comments