From f9e3a591d2363a1518599362f797f75773dfcc49 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 14 Jan 2023 19:03:55 -0500 Subject: [PATCH] 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`. --- Userland/Applications/3DFileViewer/main.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/3DFileViewer/main.cpp b/Userland/Applications/3DFileViewer/main.cpp index cea5172399..86c78597b3 100644 --- a/Userland/Applications/3DFileViewer/main.cpp +++ b/Userland/Applications/3DFileViewer/main.cpp @@ -290,14 +290,14 @@ void GLContextWidget::timer_event(Core::TimerEvent&) 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); return false; } - return load_file(file); + return load_file(file.value()); } bool GLContextWidget::load_file(Core::DeprecatedFile& file)