Only re-export image if the source file is newer than the image

This commit is contained in:
Adam Goldsmith 2021-09-15 15:19:01 -04:00
parent 5fa9bf0cdd
commit 640c8d9733
1 changed files with 7 additions and 3 deletions

View File

@ -260,9 +260,13 @@ for (let member in recurseAllChildren(Eons.getOpenProject())) {
let card_data = build_card(component);
cards.push(card_data);
const export_dir = new File(member.parent.file, 'export');
export_dir.mkdir();
exportCard(component, new File(export_dir, card_data.code + '.png'));
let export_dir = new File(member.parent.file, 'export');
let target_file = new File(export_dir, card_data.code + '.png');
if (!target_file.exists() || member.file.lastModified() > target_file.lastModified()) {
printf("Image for '%s' is out of date, rebuilding...\n", member);
export_dir.mkdir();
exportCard(component, target_file);
}
}
}
} catch (ex) {