feat(dialogs): reopen file pickers in the last-used directory

Every rfd dialog result funnels through sys::handle_path, which now
records the picked file's folder (persisted to the config dir), and all
pickers are built via sys::file_dialog(), seeded with that folder.
Save-As keeps the current tab's own directory as the first choice and
falls back to the remembered one.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-07-21 09:27:44 +03:00
commit e78ad7884d
7 changed files with 78 additions and 15 deletions

View file

@ -408,7 +408,7 @@ impl OpenCADStudio {
Message::XAttachPick => Task::perform(
async {
let handle = rfd::AsyncFileDialog::new()
let handle = crate::sys::file_dialog()
.set_title("Select External Reference File")
.add_filter("CAD Files", &["dwg", "dxf", "bak", "DWG", "DXF", "BAK"])
.add_filter("DWG Files", &["dwg", "DWG"])
@ -446,7 +446,7 @@ impl OpenCADStudio {
let name = block_name.clone();
Task::perform(
async move {
let path = rfd::AsyncFileDialog::new()
let path = crate::sys::file_dialog()
.set_title("Save Block As")
.set_file_name("block.dwg")
.add_filter("DWG Files", &["dwg"])
@ -469,7 +469,7 @@ impl OpenCADStudio {
let csv_clone = csv.clone();
Task::perform(
async move {
let path = rfd::AsyncFileDialog::new()
let path = crate::sys::file_dialog()
.set_title("Save Data Extraction")
.set_file_name("extraction.csv")
.add_filter("CSV", &["csv"])
@ -512,7 +512,7 @@ impl OpenCADStudio {
}
Task::perform(
async {
rfd::AsyncFileDialog::new()
crate::sys::file_dialog()
.set_title("Export STL")
.set_file_name("export.stl")
.add_filter("STL Files", &["stl"])
@ -539,7 +539,7 @@ impl OpenCADStudio {
}
Task::perform(
async {
rfd::AsyncFileDialog::new()
crate::sys::file_dialog()
.set_title("Export STEP AP203")
.set_file_name("export.step")
.add_filter("STEP Files", &["step", "stp"])
@ -559,7 +559,7 @@ impl OpenCADStudio {
// ── OBJ import ────────────────────────────────────────────────
Message::ObjImport => Task::perform(
async {
rfd::AsyncFileDialog::new()
crate::sys::file_dialog()
.set_title("Import OBJ Mesh")
.add_filter("Wavefront OBJ", &["obj", "OBJ"])
.add_filter("All Files", &["*"])