diff --git a/src/fs_reader.cpp b/src/fs_reader.cpp index 2ebb5df..1e1ceba 100644 --- a/src/fs_reader.cpp +++ b/src/fs_reader.cpp @@ -35,13 +35,12 @@ std::vector find_all_folders(std::string filesystem_path) { } std::vector find_all_files_and_folders(std::string filesystem_path) { - std::vector files = find_all_files(filesystem_path); - std::vector folders = find_all_folders(filesystem_path); std::vector files_and_folders = {}; - files_and_folders.reserve(files.size() + folders.size()); - files_and_folders.insert( files_and_folders.end(), files.begin(), files.end() ); - files_and_folders.insert( files_and_folders.end(), folders.begin(), folders.end() ); + for (const fs::directory_entry &entry : fs::directory_iterator(filesystem_path)) { + files_and_folders.insert(files_and_folders.begin()+files_and_folders.size(), entry.path()); + } + files_and_folders.shrink_to_fit(); return files_and_folders; }