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

FileManager: Return a StringView from PropertiesWindow::get_description

This commit is contained in:
Lucas CHOLLET 2023-07-09 11:37:02 -04:00 committed by Andreas Kling
parent ea2ffdfd0e
commit 3e6e75bb5e
2 changed files with 11 additions and 11 deletions

View file

@ -98,7 +98,7 @@ ErrorOr<void> PropertiesWindow::create_widgets(bool disable_rename)
m_old_mode = st.st_mode; m_old_mode = st.st_mode;
auto* type = general_tab->find_descendant_of_type_named<GUI::Label>("type"); auto* type = general_tab->find_descendant_of_type_named<GUI::Label>("type");
type->set_text(TRY(String::from_deprecated_string(get_description(m_mode)))); type->set_text(TRY(String::from_utf8(get_description(m_mode))));
if (S_ISLNK(m_mode)) { if (S_ISLNK(m_mode)) {
auto link_destination_or_error = FileSystem::read_link(m_path); auto link_destination_or_error = FileSystem::read_link(m_path);

View file

@ -56,26 +56,26 @@ private:
Queue<DeprecatedString> m_work_queue; Queue<DeprecatedString> m_work_queue;
}; };
static DeprecatedString const get_description(mode_t const mode) static StringView const get_description(mode_t const mode)
{ {
if (S_ISREG(mode)) if (S_ISREG(mode))
return "File"; return "File"sv;
if (S_ISDIR(mode)) if (S_ISDIR(mode))
return "Directory"; return "Directory"sv;
if (S_ISLNK(mode)) if (S_ISLNK(mode))
return "Symbolic link"; return "Symbolic link"sv;
if (S_ISCHR(mode)) if (S_ISCHR(mode))
return "Character device"; return "Character device"sv;
if (S_ISBLK(mode)) if (S_ISBLK(mode))
return "Block device"; return "Block device"sv;
if (S_ISFIFO(mode)) if (S_ISFIFO(mode))
return "FIFO (named pipe)"; return "FIFO (named pipe)"sv;
if (S_ISSOCK(mode)) if (S_ISSOCK(mode))
return "Socket"; return "Socket"sv;
if (mode & S_IXUSR) if (mode & S_IXUSR)
return "Executable"; return "Executable"sv;
return "Unknown"; return "Unknown"sv;
} }
static ErrorOr<NonnullRefPtr<GUI::Button>> make_button(String, GUI::Widget& parent); static ErrorOr<NonnullRefPtr<GUI::Button>> make_button(String, GUI::Widget& parent);