diff --git a/Userland/Applications/3DFileViewer/MeshLoader.h b/Userland/Applications/3DFileViewer/MeshLoader.h index 62c6ae609c..d1206cacd8 100644 --- a/Userland/Applications/3DFileViewer/MeshLoader.h +++ b/Userland/Applications/3DFileViewer/MeshLoader.h @@ -17,5 +17,5 @@ public: MeshLoader() = default; virtual ~MeshLoader() = default; - virtual ErrorOr> load(String const& filename, NonnullOwnPtr file) = 0; + virtual ErrorOr> load(ByteString const& filename, NonnullOwnPtr file) = 0; }; diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp index b455989234..d6537e89e9 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.cpp @@ -25,7 +25,7 @@ static ErrorOr parse_float(StringView string) return maybe_float.release_value(); } -ErrorOr> WavefrontOBJLoader::load(String const& filename, NonnullOwnPtr file) +ErrorOr> WavefrontOBJLoader::load(ByteString const& filename, NonnullOwnPtr file) { auto buffered_file = TRY(Core::InputBufferedFile::create(move(file))); diff --git a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h index 9ceb524385..896b79c33b 100644 --- a/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h +++ b/Userland/Applications/3DFileViewer/WavefrontOBJLoader.h @@ -18,5 +18,5 @@ public: WavefrontOBJLoader() = default; ~WavefrontOBJLoader() override = default; - ErrorOr> load(String const& filename, NonnullOwnPtr file) override; + ErrorOr> load(ByteString const& filename, NonnullOwnPtr file) override; }; diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index ac7fd55fa9..def9535b59 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -34,7 +34,7 @@ class GLContextWidget final : public GUI::Frame { C_OBJECT(GLContextWidget); public: - bool load_file(String const& filename, NonnullOwnPtr file); + bool load_file(ByteString const& filename, NonnullOwnPtr file); void toggle_rotate_x() { m_rotate_x = !m_rotate_x; } void toggle_rotate_y() { m_rotate_y = !m_rotate_y; } void toggle_rotate_z() { m_rotate_z = !m_rotate_z; } @@ -153,7 +153,7 @@ void GLContextWidget::drop_event(GUI::DropEvent& event) auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), url.serialize_path()); if (response.is_error()) return; - load_file(MUST(String::from_byte_string(response.value().filename())), response.value().release_stream()); + load_file(response.value().filename(), response.value().release_stream()); } } @@ -289,9 +289,9 @@ void GLContextWidget::timer_event(Core::TimerEvent&) m_cycles++; } -bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr file) +bool GLContextWidget::load_file(ByteString const& filename, NonnullOwnPtr file) { - if (!filename.bytes_as_string_view().ends_with(".obj"sv)) { + if (!filename.ends_with(".obj"sv)) { GUI::MessageBox::show(window(), ByteString::formatted("Opening \"{}\" failed: invalid file type", filename), "Error"sv, GUI::MessageBox::Type::Error); return false; } @@ -304,7 +304,7 @@ bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr serenity_main(Main::Arguments arguments) return; auto file = response.release_value(); - widget->load_file(MUST(String::from_byte_string(file.filename())), file.release_stream()); + widget->load_file(file.filename(), file.release_stream()); })); file_menu->add_separator(); file_menu->add_action(GUI::CommonActions::make_quit_action([&](auto&) { @@ -583,7 +583,7 @@ ErrorOr serenity_main(Main::Arguments arguments) GUI::MessageBox::show(window, ByteString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); return 1; } - widget->load_file(TRY(String::from_byte_string(file.value().filename())), file.value().release_stream()); + widget->load_file(file.value().filename(), file.value().release_stream()); return app->exec(); }