forked from 1b-agent/opencadstudio-upstream
fix(save-dialog): allow navigating to other drives (#170)
The custom Save As dialog navigated up the tree solely via `Path::parent()`, which returns `None` at a drive root (`C:\`). Navigation therefore dead-ended on the starting volume, so other drives and USB sticks were unreachable. Add a synthetic Windows "This PC" drives root above the drive letters. `parent_folder()` now climbs `…\sub → C:\ → This PC`, and `read_dir_entries()` lists the available volumes (probed A:–Z: by stat, no new dependency) when at that root. The dialog's up-button and path bar route through the same helper and show "This PC". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
8020286553
commit
ef229f5d85
2 files changed
+66
-4
No files matched your search
+6
-2
@@ -3471,8 +3471,12 @@ fn save_as_dialog_window<'a>(
|
||||
};
|
||||
|
||||
// ── Path bar ─────────────────────────────────────────────────────────
|
||||
let path_str = folder.to_string_lossy().into_owned();
|
||||
let up_path = folder.parent().map(|p| p.to_path_buf());
|
||||
let path_str = if crate::io::is_drives_root(folder) {
|
||||
"This PC".to_string()
|
||||
} else {
|
||||
folder.to_string_lossy().into_owned()
|
||||
};
|
||||
let up_path = crate::io::parent_folder(folder);
|
||||
let path_bar = row![
|
||||
{
|
||||
let up_msg = up_path.map(Message::SaveDialogNavigate);
|
||||
|
||||
Reference in new issue
Block a user