mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
73fdbba59c
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
29 lines
575 B
C++
29 lines
575 B
C++
#pragma once
|
|
|
|
#include <AK/String.h>
|
|
#include <dirent.h>
|
|
|
|
class CDirIterator {
|
|
public:
|
|
enum Flags {
|
|
NoFlags = 0x0,
|
|
SkipDots = 0x1,
|
|
};
|
|
|
|
CDirIterator(const StringView& path, Flags = Flags::NoFlags);
|
|
~CDirIterator();
|
|
|
|
bool has_error() const { return m_error != 0; }
|
|
int error() const { return m_error; }
|
|
const char* error_string() const { return strerror(m_error); }
|
|
bool has_next();
|
|
String next_path();
|
|
|
|
private:
|
|
DIR* m_dir = nullptr;
|
|
int m_error = 0;
|
|
String m_next;
|
|
int m_flags;
|
|
|
|
bool advance_next();
|
|
};
|