Luna/libos/include/os/Directory.h
apio 3eb78aa5f3
All checks were successful
continuous-integration/drone/push Build is passing
libos+init: Add a new Path class to handle both file descriptors and file paths
2023-05-03 17:37:26 +02:00

41 lines
681 B
C++

#pragma once
#include <dirent.h>
#include <luna/SharedPtr.h>
#include <luna/String.h>
#include <luna/Vector.h>
#include <os/Path.h>
namespace os
{
class Directory
{
public:
static Result<SharedPtr<Directory>> open(const Path& path);
enum class Filter
{
None,
Hidden,
ParentAndBase
};
Result<String> next(Filter filter);
Result<Vector<String>> list(Filter filter);
void rewind();
int fd()
{
return dirfd(m_dirp);
}
~Directory();
private:
Directory(Badge<Directory>);
DIR* m_dirp { nullptr };
};
}