Skip to content

Commit

Permalink
fix(launchpad): default mountpoint not available on disks list
Browse files Browse the repository at this point in the history
  • Loading branch information
mazzi committed Sep 16, 2024
1 parent 5bf3b79 commit 87a65df
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 7 additions & 0 deletions node-launchpad/src/components/popup/change_drive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 7 additions & 1 deletion node-launchpad/src/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand Down

0 comments on commit 87a65df

Please sign in to comment.