1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:17:46 +00:00

LibCore: Add an optional permissions mask to Directory::create()

Being able to pass a mask is the one feature `mkdir()` had that this
didn't. Adding it here means everyone can use the nicer Directory API.
This commit is contained in:
Sam Atkins 2022-04-13 11:53:46 +01:00 committed by Andreas Kling
parent 6967d37678
commit 72893b4f9e
2 changed files with 10 additions and 10 deletions

View file

@ -33,8 +33,8 @@ public:
Yes,
};
static ErrorOr<Directory> create(LexicalPath path, CreateDirectories);
static ErrorOr<Directory> create(String path, CreateDirectories);
static ErrorOr<Directory> create(LexicalPath path, CreateDirectories, mode_t creation_mode = 0755);
static ErrorOr<Directory> create(String path, CreateDirectories, mode_t creation_mode = 0755);
static ErrorOr<Directory> adopt_fd(int fd, Optional<LexicalPath> path = {});
ErrorOr<NonnullOwnPtr<Stream::File>> open(StringView filename, Stream::OpenMode mode) const;
@ -47,7 +47,7 @@ public:
private:
Directory(int directory_fd, Optional<LexicalPath> path);
static ErrorOr<void> ensure_directory(LexicalPath const& path);
static ErrorOr<void> ensure_directory(LexicalPath const& path, mode_t creation_mode = 0755);
Optional<LexicalPath> m_path;
int m_directory_fd;