1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 08:07:44 +00:00

3DFileViewer: Use LibFSAC in GLContextWidget::load_path()

It was the only function to not use the `LibFSAC`, it will allow us to:
 - Not unveil some file
 - Drop some tests on to-be-read-from file as they are performed in
   `LibFSAC`.
This commit is contained in:
Lucas CHOLLET 2023-01-14 19:03:55 -05:00 committed by Sam Atkins
parent b4cea1c72e
commit f9e3a591d2

View file

@ -290,14 +290,14 @@ void GLContextWidget::timer_event(Core::TimerEvent&)
bool GLContextWidget::load_path(DeprecatedString const& filename) bool GLContextWidget::load_path(DeprecatedString const& filename)
{ {
auto file = Core::DeprecatedFile::construct(filename); auto file = FileSystemAccessClient::Client::the().try_request_file_read_only_approved_deprecated(window(), filename);
if (!file->open(Core::OpenMode::ReadOnly) && file->error() != ENOENT) { if (!file.is_error() && file.error().code() != ENOENT) {
GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error); GUI::MessageBox::show(window(), DeprecatedString::formatted("Opening \"{}\" failed: {}", filename, strerror(errno)), "Error"sv, GUI::MessageBox::Type::Error);
return false; return false;
} }
return load_file(file); return load_file(file.value());
} }
bool GLContextWidget::load_file(Core::DeprecatedFile& file) bool GLContextWidget::load_file(Core::DeprecatedFile& file)