mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:37:36 +00:00
3DFileViewer: Don't try to open textures without LibFSASC
This commit is contained in:
parent
9c2800fbb5
commit
95a03f8ed6
1 changed files with 4 additions and 12 deletions
|
@ -318,22 +318,14 @@ bool GLContextWidget::load_file(String const& filename, NonnullOwnPtr<Core::File
|
||||||
builder.append(filename.bytes_as_string_view().split_view('.').at(0));
|
builder.append(filename.bytes_as_string_view().split_view('.').at(0));
|
||||||
builder.append(".bmp"sv);
|
builder.append(".bmp"sv);
|
||||||
|
|
||||||
DeprecatedString texture_path = Core::DeprecatedFile::absolute_path(builder.string_view());
|
|
||||||
|
|
||||||
// Attempt to open the texture file from disk
|
// Attempt to open the texture file from disk
|
||||||
RefPtr<Gfx::Bitmap> texture_image;
|
RefPtr<Gfx::Bitmap> texture_image;
|
||||||
if (Core::DeprecatedFile::exists(texture_path)) {
|
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), builder.string_view());
|
||||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_path);
|
if (!response.is_error()) {
|
||||||
|
auto texture_file = response.release_value();
|
||||||
|
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_file.release_stream(), texture_file.filename());
|
||||||
if (!bitmap_or_error.is_error())
|
if (!bitmap_or_error.is_error())
|
||||||
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
||||||
} else {
|
|
||||||
auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), builder.string_view());
|
|
||||||
if (!response.is_error()) {
|
|
||||||
auto texture_file = response.release_value();
|
|
||||||
auto bitmap_or_error = Gfx::Bitmap::load_from_file(texture_file.release_stream(), texture_file.filename());
|
|
||||||
if (!bitmap_or_error.is_error())
|
|
||||||
texture_image = bitmap_or_error.release_value_but_fixme_should_propagate_errors();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint tex;
|
GLuint tex;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue