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

LibCore+Userland: Remove uses of DeprecatedString in file utility

Mainly replacing DeprecatedString with StringView, since the actual mime
type and description texts are just static strings anyway.
This commit is contained in:
Valtteri Koskivuori 2023-02-01 21:39:31 +02:00 committed by Tim Flynn
parent 43e1343abf
commit e56098f734
5 changed files with 86 additions and 83 deletions

View file

@ -177,7 +177,7 @@ Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url)
return handlers;
}
Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path)
Optional<StringView> Launcher::mime_type_for_file(DeprecatedString path)
{
auto file_or_error = Core::File::open(path, Core::File::OpenMode::Read);
if (file_or_error.is_error())

View file

@ -51,7 +51,7 @@ private:
HashMap<DeprecatedString, DeprecatedString> m_mime_handlers;
bool has_mime_handlers(DeprecatedString const&);
Optional<DeprecatedString> mime_type_for_file(DeprecatedString path);
Optional<StringView> mime_type_for_file(DeprecatedString path);
Handler get_handler_for_executable(Handler::Type, DeprecatedString const&) const;
size_t for_each_handler(DeprecatedString const& key, HashMap<DeprecatedString, DeprecatedString> const& user_preferences, Function<bool(Handler const&)> f);
void for_each_handler_for_path(DeprecatedString const&, Function<bool(Handler const&)> f);