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

3DFileViewer: Port MeshLoader and its child to the new Core::File

As it was using the `lines()` method of `Core::DeprecatedFile`, this
patch also introduce the usage of `BufferedFile` to take advantage of
its API: `can_read_line()` and `read_line()`.
This commit is contained in:
Lucas CHOLLET 2023-01-14 18:56:37 -05:00 committed by Sam Atkins
parent 83da3c5c3e
commit b4cea1c72e
4 changed files with 14 additions and 6 deletions

View file

@ -318,7 +318,8 @@ bool GLContextWidget::load_file(Core::DeprecatedFile& file)
return false;
}
auto new_mesh = m_mesh_loader->load(file);
auto new_mesh = m_mesh_loader->load(String::from_deprecated_string(file.filename()).release_value_but_fixme_should_propagate_errors(),
Core::File::adopt_fd(file.leak_fd(), Core::File::OpenMode::Read).release_value_but_fixme_should_propagate_errors());
if (new_mesh.is_error()) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Reading \"{}\" failed: {}", filename, new_mesh.release_error()), "Error"sv, GUI::MessageBox::Type::Error);
return false;