Skip to content

Commit ba02cfd

Browse files
AeroXukDinnerbone
authored andcommitted
Format frame filenames with leading zeros in screenshot captures
1 parent 48db227 commit ba02cfd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

exporter/src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,10 @@ fn capture_single_swf(descriptors: Arc<Descriptors>, opt: &Opt) -> Result<()> {
278278
image.save(&output)?;
279279
}
280280
} else {
281+
let digits = frames.len().to_string().len();
281282
for (frame, image) in frames.iter().enumerate() {
282283
let mut path: PathBuf = (&output).into();
283-
path.push(format!("{frame}.png"));
284+
path.push(format!("{frame:0digits$}.png"));
284285
image.save(&path)?;
285286
}
286287
}
@@ -372,9 +373,10 @@ fn capture_multiple_swfs(descriptors: Arc<Descriptors>, opt: &Opt) -> Result<()>
372373
relative_path.set_extension("");
373374
parent.push(&relative_path);
374375
let _ = create_dir_all(&parent);
376+
let digits = frames.len().to_string().len();
375377
for (frame, image) in frames.iter().enumerate() {
376378
let mut destination = parent.clone();
377-
destination.push(format!("{frame}.png"));
379+
destination.push(format!("{frame:0digits$}.png"));
378380
image.save(&destination)?;
379381
}
380382
}

0 commit comments

Comments
 (0)