From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- Src/Wasabi/bfc/file/recursedir.h | 73 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Src/Wasabi/bfc/file/recursedir.h (limited to 'Src/Wasabi/bfc/file/recursedir.h') diff --git a/Src/Wasabi/bfc/file/recursedir.h b/Src/Wasabi/bfc/file/recursedir.h new file mode 100644 index 00000000..2c40c7ac --- /dev/null +++ b/Src/Wasabi/bfc/file/recursedir.h @@ -0,0 +1,73 @@ +#ifndef _RECURSEDIR_H +#define _RECURSEDIR_H + +#include +#include +#include +#include + +class ReadDir; + +/** + Read the contents of a directory, recursively. + Also possible to use search match patterns. + + @short Recursive directory reading. + @author Nullsoft + @ver 1.0 + @see ReadDir +*/ +class RecurseDir { +public: + /** + Sets the directory to read and the match pattern. + If no match pattern is set, it will match against + all files. + + @param path The path of the directory to read. + @param match The match pattern to use. + */ + RecurseDir(const wchar_t *path, const wchar_t *match=NULL); + + /** + Deletes the directory stack. + */ + ~RecurseDir(); + + /** + Advance to the next file. + + @ret 0, No more files to read; > 0, Files left to read. + */ + int next(); + + /** + Restart from the top of the directory tree. + + @ret 0 + */ + int restart(); + + /** + Get the current directory path. + + @ret The path. + */ + const wchar_t *getPath(); + + /** + Get the filename for the current file. + + @ret The filename. + */ + const wchar_t *getFilename(); + + const wchar_t *getOriginalPath(); + +private: + StringW path, match; + ReadDir *curdir; + PtrList dirstack; +}; + +#endif -- cgit