Open dropped SVG paths via the shared reader

This commit is contained in:
David Campos 2026-10-09 19:21:37 +04:00 committed by bflatastic
parent 8edee45588
commit b6625f6964
1 changed files with 8 additions and 5 deletions

View File

@ -348,11 +348,14 @@ pub fn drop_files(app: &mut VectorcraftApp, mut files: Vec<(DropTarget, DropFile
p["link"] = json!(!embed);
run(app, &p).map(|_| ())
}
DropTarget::Open => io::open_bytes(app, &name, &bytes, path.clone()).map(|_| {
if let Some(path) = &path {
io::note_recent(app, path);
}
}),
DropTarget::Open => match path.as_deref() {
Some(path) if app.services.read.is_some() => io::open_path(app, path).map(|_| ()),
_ => io::open_bytes(app, &name, &bytes, path.clone()).map(|_| {
if let Some(path) = &path {
io::note_recent(app, path);
}
}),
},
};
if let Err(e) = r {
app.status(if target == DropTarget::Open { format!("Couldn't open {name}: {e}") } else { format!("Couldn't place {name}: {e}") });