From b37fe9bed32a78bbe43ba2c152989d34f051ef85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 8 May 2021 15:12:58 +0200 Subject: Make a backup of out/index.html before generation --- gen.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gen.pl b/gen.pl index 2a6b6e8..b3a3b8a 100755 --- a/gen.pl +++ b/gen.pl @@ -36,6 +36,7 @@ chdir $Bin; mkdir 'out' if ! -d 'out'; open my $src, '<', 'src/index.html' or die "Could not open < src/index.html: $!"; open my $out, '>', 'out/index.html.tmp' or die "Could not open > out/index.html.tmp: $!"; +copy 'src/index.html', 'src/index.html.bkp'; select $out; for (<$src>) { when (/^\.inc (.*)/) { @@ -75,7 +76,7 @@ for (<$src>) { close $cache; close $run; if ($i) { - move "cache/$1.tmp" => "cache/$1"; + move "cache/$1.tmp", "cache/$1"; next; } } @@ -98,7 +99,7 @@ close $src; # Rename temporary file -move 'out/index.html.tmp' => 'out/index.html'; +move 'out/index.html.tmp', 'out/index.html'; # Copy modified static files @@ -110,7 +111,7 @@ for (keys %src) { no warnings 'uninitialized'; if ($src{$_} > $out{$_}) { print STDERR "COPY: src/$_ => out/$_\n" if $opt{d}; - copy "src/$_" => "out/$_"; + copy "src/$_", "out/$_"; } } closedir $out; -- cgit v1.2.3