1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 01:51:03 +09:00
ladybird/Userland/Libraries/LibCore/DirectoryEntry.h
stasoid cf198d0d60 Partially revert "LibCore: Add Windows version of DirIterator"
This reverts commit d92a96c40a, but
keeps changes to AK/Error{.h,.cpp} (function Error::from_windows_error)
2024-11-05 10:42:44 -07:00

39 lines
893 B
C++

/*
* Copyright (c) 2023, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteString.h>
#include <AK/StringView.h>
#include <dirent.h>
namespace Core {
struct DirectoryEntry {
enum class Type {
BlockDevice,
CharacterDevice,
Directory,
File,
NamedPipe,
Socket,
SymbolicLink,
Unknown,
Whiteout,
};
Type type;
// FIXME: Once we have a special Path string class, use that.
ByteString name;
ino_t inode_number;
static StringView posix_name_from_directory_entry_type(Type);
static StringView representative_name_from_directory_entry_type(Type);
static Type directory_entry_type_from_stat(mode_t st_mode);
static DirectoryEntry from_dirent(dirent const&);
static DirectoryEntry from_stat(DIR*, dirent const&);
};
}