37 lines
638 B
C
37 lines
638 B
C
|
#pragma once
|
||
|
#include <dirent.h>
|
||
|
#include <luna/SharedPtr.h>
|
||
|
#include <luna/String.h>
|
||
|
|
||
|
namespace os
|
||
|
{
|
||
|
class Directory
|
||
|
{
|
||
|
public:
|
||
|
static Result<SharedPtr<Directory>> open(StringView path);
|
||
|
|
||
|
static Result<SharedPtr<Directory>> openat(int dirfd, StringView path);
|
||
|
|
||
|
enum class Filter
|
||
|
{
|
||
|
None,
|
||
|
Hidden,
|
||
|
ParentAndBase
|
||
|
};
|
||
|
|
||
|
Result<String> next(Filter filter);
|
||
|
|
||
|
int fd()
|
||
|
{
|
||
|
return dirfd(m_dirp);
|
||
|
}
|
||
|
|
||
|
~Directory();
|
||
|
|
||
|
private:
|
||
|
Directory(Badge<Directory>);
|
||
|
|
||
|
DIR* m_dirp { nullptr };
|
||
|
};
|
||
|
}
|