🟩 Enumerates files and directories inside a given path
SaneCppFileSystemIterator.h is a library that enumerates files and directories at a given path.
🟩 Usable
The library is simple but gets the job done.
Some relevant blog posts are:
FileSystemIterator uses an iterator pattern to enumerate files instead of a callback. This allows avoiding blocking on enumeration of very large directories and also the allocation of a huge number of strings to hold all filenames. When configuring an iteration, the caller can ask for a fully recursive enumeration or manually call SC::FileSystemIterator::recurseSubdirectory when the current SC::FileSystemIterator::Entry item (obtained with SC::FileSystemIterator::get) matches a directory of interest. The maximum number of nested recursion levels that will be allowed depends on the size of the FileSystemIterator::FolderState span (can be a static array) passed in during init by the caller.
Example of recursive iteration of a directory:
If only some directories should be recursed, manual recursion can help speeding up directory iteration:
🟦 Complete Features:
💡 Unplanned Features:
Type | Lines Of Code | Comments | Sum |
---|---|---|---|
Headers | 78 | 72 | 150 |
Sources | 352 | 68 | 420 |
Sum | 430 | 140 | 570 |