From 4e28ea1cf67791cfcd952681d45ad61c91bc6422 Mon Sep 17 00:00:00 2001 From: Sophie Herold Date: Sun, 27 Aug 2023 22:20:13 +0200 Subject: [PATCH] fileDialog: Pre-select current image's folder Part-of: --- src/window.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/window.rs b/src/window.rs index f264234..a5d004b 100644 --- a/src/window.rs +++ b/src/window.rs @@ -502,6 +502,14 @@ impl LpWindow { .modal(true) .build(); + chooser.set_initial_folder( + self.image_view() + .current_image() + .and_then(|x| x.file()) + .and_then(|x| x.parent()) + .as_ref(), + ); + if let Ok(selected) = chooser.open_multiple_future(Some(self)).await { let images: Vec<_> = selected .into_iter()