diff --git a/src/data/disks.rs b/src/data/disks.rs index f05542d6..2db18f14 100644 --- a/src/data/disks.rs +++ b/src/data/disks.rs @@ -92,11 +92,19 @@ impl Disks { /// Queries the operating system for disks pub fn new_native_disks(canonicalize_paths: bool) -> Self { + println!("LOADING_DISKS: {canonicalize_paths}"); Self { disks: load_disks(canonicalize_paths), } } + /// Creates an empty list of Disks + pub fn new_empty() -> Self { + Self { + disks: Vec::new(), + } + } + /// Very simple wrapper method of the disks `.iter()` method. /// No trait is implemented since this is currently only used internal. pub(crate) fn iter(&self) -> std::slice::Iter<'_, Disk> { diff --git a/src/file_dialog.rs b/src/file_dialog.rs index c95a1ce6..79166ee2 100644 --- a/src/file_dialog.rs +++ b/src/file_dialog.rs @@ -204,8 +204,8 @@ impl FileDialog { window_id: egui::Id::new("file_dialog"), - user_directories: file_system.user_dirs(true), - system_disks: file_system.get_disks(true), + user_directories: None, + system_disks: Disks::new_empty(), directory_stack: Vec::new(), directory_offset: 0, @@ -246,9 +246,6 @@ impl FileDialog { pub fn with_config(config: FileDialogConfig) -> Self { let mut obj = Self::new(); *obj.config_mut() = config; - - obj.refresh(); - obj } @@ -320,6 +317,7 @@ impl FileDialog { operation_id: Option<&str>, ) -> io::Result<()> { self.reset(); + self.refresh(); if mode == DialogMode::PickFile { show_files = true; @@ -568,10 +566,6 @@ impl FileDialog { /// already canonicalized path is then set as the initial directory. pub fn canonicalize_paths(mut self, canonicalize: bool) -> Self { self.config.canonicalize_paths = canonicalize; - - // Reload data like system disks and user directories with the updated canonicalization. - self.refresh(); - self }