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

LibCore: Add methods to convert DirectoryEntry types to names

We can either convert DirectoryEntry::type to its representative name or
to the POSIX DT_* name.
This commit is contained in:
Liav A 2024-01-05 12:27:19 +02:00 committed by Andrew Kaster
parent 90152dc859
commit d568b09632
2 changed files with 53 additions and 0 deletions

View file

@ -7,6 +7,7 @@
#pragma once
#include <AK/ByteString.h>
#include <AK/StringView.h>
#include <dirent.h>
namespace Core {
@ -28,6 +29,8 @@ struct DirectoryEntry {
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&);