aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/bfc/file/readdir.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/bfc/file/readdir.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Wasabi/bfc/file/readdir.h')
-rw-r--r--Src/Wasabi/bfc/file/readdir.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/Src/Wasabi/bfc/file/readdir.h b/Src/Wasabi/bfc/file/readdir.h
new file mode 100644
index 00000000..edfc9d87
--- /dev/null
+++ b/Src/Wasabi/bfc/file/readdir.h
@@ -0,0 +1,48 @@
+#ifndef _READDIR_H
+#define _READDIR_H
+
+
+
+#include <bfc/common.h>
+#include <bfc/string/StringW.h>
+
+/* intended use:
+ ReadDir dir(path);
+ while (dir.next()) {
+ const char *fn = dir.getFilename();
+ }
+*/
+
+class ReadDir
+{
+public:
+ ReadDir(const wchar_t *path, const wchar_t *match=NULL, bool skipdots=true);
+ ~ReadDir();
+
+ int next(); // done when returns 0
+ const wchar_t *getFilename();
+ int isDir(); // if current file is a dir
+ int isReadonly(); // if current file is readonly
+
+ int isDotDir(); // if given dir iteself is being enumerated (usually ".")
+ int isDotDotDir(); // if parent dir of cur dir is showing (usually "..")
+
+ const wchar_t *getPath() { return path; }
+
+private:
+ StringW path, match;
+ int skipdots, first;
+//PORT
+#ifdef WIN32
+ HANDLE files;
+ WIN32_FIND_DATAW data; // (shrug) so we have two? so what?
+ //StringW filename;
+#endif
+#ifdef LINUX
+ DIR *d;
+ struct dirent *de;
+ struct stat st;
+#endif
+};
+
+#endif