diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2023-04-26 19:22:43 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-27 07:29:49 +0200 |
commit | d7ca3a51967ea0cd7cd97c42d2437a7b4fdb7900 (patch) | |
tree | 88b34e856a13c0085fdd7ca689bbe66b9ad9bfad /Userland/Services/LaunchServer | |
parent | 50b5528746723511a6b8ec7cad69ba36d08bad86 (diff) | |
download | serenity-d7ca3a51967ea0cd7cd97c42d2437a7b4fdb7900.zip |
LaunchServer: Remove usage of `DeprecatedFile`
And use the new `guess_mime_type_based_on_sniffed_bytes` helper.
Diffstat (limited to 'Userland/Services/LaunchServer')
-rw-r--r-- | Userland/Services/LaunchServer/Launcher.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Userland/Services/LaunchServer/Launcher.cpp b/Userland/Services/LaunchServer/Launcher.cpp index 4bb08ea1dc..b77341ae3c 100644 --- a/Userland/Services/LaunchServer/Launcher.cpp +++ b/Userland/Services/LaunchServer/Launcher.cpp @@ -179,16 +179,11 @@ Vector<DeprecatedString> Launcher::handlers_with_details_for_url(const URL& url) Optional<DeprecatedString> Launcher::mime_type_for_file(DeprecatedString path) { - auto file_or_error = Core::DeprecatedFile::open(path, Core::OpenMode::ReadOnly); - if (file_or_error.is_error()) { + auto file_or_error = Core::File::open(path, Core::File::OpenMode::Read); + if (file_or_error.is_error()) return {}; - } else { - auto file = file_or_error.release_value(); - // Read accounts for longest possible offset + signature we currently match against. - auto bytes = file->read(0x9006); - return Core::guess_mime_type_based_on_sniffed_bytes(bytes.bytes()); - } + return Core::guess_mime_type_based_on_sniffed_bytes(*file_or_error.release_value()); } bool Launcher::open_url(const URL& url, DeprecatedString const& handler_name) |