From 72a5347f914ddc179ececb33b1f96e611fbae853 Mon Sep 17 00:00:00 2001 From: Marcus Nilsson Date: Sat, 17 Jul 2021 16:40:18 +0200 Subject: [PATCH] LibGUI: Pass path to FileSystemModel when creating FilePicker This saves a few lstat lookups since otherwise '/' is indexed before set_path() is called. It also cleans up warnings if '/' is not unveiled when opening FilePicker, like in WidgetGallery. --- Userland/Libraries/LibGUI/FilePicker.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibGUI/FilePicker.cpp b/Userland/Libraries/LibGUI/FilePicker.cpp index f71b6bb611..c8cf52bcbe 100644 --- a/Userland/Libraries/LibGUI/FilePicker.cpp +++ b/Userland/Libraries/LibGUI/FilePicker.cpp @@ -64,7 +64,7 @@ Optional FilePicker::get_save_filepath(Window* parent_window, const Stri FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filename, const StringView& path) : Dialog(parent_window) - , m_model(FileSystemModel::create()) + , m_model(FileSystemModel::create(path)) , m_mode(mode) { switch (m_mode) { @@ -232,7 +232,7 @@ FilePicker::FilePicker(Window* parent_window, Mode mode, const StringView& filen m_common_location_buttons.append({ path, button }); } - set_path(path); + m_location_textbox->set_icon(FileIconProvider::icon_for_path(path).bitmap_for_size(16)); } FilePicker::~FilePicker()