From 87a65df7054c6d0ee67eb4f0c408d10a00f2ebfa Mon Sep 17 00:00:00 2001 From: Lautaro Mazzitelli Date: Thu, 12 Sep 2024 11:49:32 +0200 Subject: [PATCH] fix(launchpad): default mountpoint not available on disks list --- node-launchpad/src/components/popup/change_drive.rs | 7 +++++++ node-launchpad/src/system.rs | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/node-launchpad/src/components/popup/change_drive.rs b/node-launchpad/src/components/popup/change_drive.rs index ad58e21dcc..a2cfd0e024 100644 --- a/node-launchpad/src/components/popup/change_drive.rs +++ b/node-launchpad/src/components/popup/change_drive.rs @@ -508,6 +508,13 @@ impl Component for ChangeDrivePopup { let _ = self.update_drive_items(); None } + Action::StoreStorageDrive(mountpoint, _drive_name) => { + self.storage_mountpoint = mountpoint; + let _ = self.update_drive_items(); + self.select_drive(); + None + } + _ => None, }; Ok(send_back) diff --git a/node-launchpad/src/system.rs b/node-launchpad/src/system.rs index 7d57ae91e6..d1691e0d80 100644 --- a/node-launchpad/src/system.rs +++ b/node-launchpad/src/system.rs @@ -67,6 +67,11 @@ pub fn get_list_of_available_drives_and_available_space( let disks = Disks::new_with_refreshed_list(); let mut drives: Vec<(String, PathBuf, u64, bool)> = Vec::new(); + let default_mountpoint = match get_default_mount_point() { + Ok((_name, mountpoint)) => mountpoint, + Err(_) => PathBuf::new(), + }; + for disk in disks.list() { let disk_info = ( disk.name() @@ -76,7 +81,8 @@ pub fn get_list_of_available_drives_and_available_space( .to_string(), disk.mount_point().to_path_buf(), disk.available_space(), - has_read_write_access(disk.mount_point().to_path_buf()), + has_read_write_access(disk.mount_point().to_path_buf()) + || default_mountpoint == disk.mount_point().to_path_buf(), ); // We avoid adding the same disk multiple times if it's mounted in multiple places