Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Integration: merge main

aiongg934eb71d8427
diff --cc crates/engine/src/file_cmds.rs
index b473210fc,1833d0a61..e3f6e815e
--- a/crates/engine/src/file_cmds.rs
+++ b/crates/engine/src/file_cmds.rs
@@@ -1419,16 -1259,11 +1419,18 @@@ fn batch(s: &mut Session, p: &Value) -
let actions = crate::actions_cmds::ActionState { list, playing: s.actions.playing, playback_stack: s.actions.playback_stack.clone(), ..Default::default() };
let names = batch_naming::plan(&inputs, &output, &format, p)?;
let save = SaveOpts::from_params(s, p, cmd)?;
- let run = |scratch: &mut Session, out: &str| {
+ let authorize = s.authorize;
- let run = move |scratch: &mut Session| {
++ let run = move |scratch: &mut Session, out: &str| {
+ scratch.authorize = authorize;
scratch.actions = actions.clone();
+ // The document as the last recorded save found it, written once the action has run so a
+ // failing step still writes nothing.
+ let mut saved: Option<Arc<Document>> = None;
for (id, params) in &steps {
+ if batch_save_point(id) {
+ saved = Some(scratch.active().ok_or(EngineError::NoDocument)?.doc.clone());
+ continue;
+ }
let r = scratch.execute(id, params.clone())?;
// A failed step inside a called action makes this file an error, not a saved result.
if let Some(error) = crate::actions_cmds::nested_failure(id, &r) {