From ecda1b2093f9fee9c820ccbd1a0e69022aa1f3af Mon Sep 17 00:00:00 2001
From: ezsh <ezsh.junk@gmail.com>
Date: Sun, 13 Jan 2019 22:02:59 +0100
Subject: [PATCH] Do not owerwrite result file twice during compilation

...to avoid double reloading by a browser.
---
 compile     | 5 +++--
 compile-git | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/compile b/compile
index 3a300d82c5c..295890fa617 100755
--- a/compile
+++ b/compile
@@ -53,7 +53,7 @@ else
 	esac
 fi
 
-$TWEEGO_EXE -o "bin/FC_pregmod.html" src/ || build_failed="true"
+$TWEEGO_EXE -o "bin/FC_pregmod_tmp.html" src/ || build_failed="true"
 
 # Revert AlphaDisclaimer for next compilation
 git checkout -- src/gui/mainMenu/AlphaDisclaimer.tw
@@ -64,4 +64,5 @@ then
 fi
 
 #Make the output prettier, replacing \t with a tab and \n with a newline
-sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g'  bin/FC_pregmod.html
+sed -i -e '/^.*<div id="store-area".*$/s/\\t/\t/g' -e '/^.*<div id="store-area".*$/s/\\n/\n/g' bin/FC_pregmod_tmp.html \
+   && mv bin/FC_pregmod_tmp.html bin/FC_pregmod.html
diff --git a/compile-git b/compile-git
index d462d20c070..f077fe27905 100755
--- a/compile-git
+++ b/compile-git
@@ -35,9 +35,10 @@ else
 	esac
 fi
 
-$TWEEGO_EXE -o "bin/FC_pregmod_$HASH.html" src/
+$TWEEGO_EXE -o "bin/FC_pregmod_${HASH}_tmp.html" src/
 
 #Make the output prettier, replacing \t with a tab and \n with a newline
-sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g'  "bin/FC_pregmod_$HASH.html"
+sed -i -e '/^<div id="store-area".*$/s/\\t/\t/g' -e '/^<div id="store-area".*$/s/\\n/\n/g'  "bin/FC_pregmod_${HASH}_tmp.html" \
+	&& mv "bin/FC_pregmod_${HASH}_tmp.html" "bin/FC_pregmod_${HASH}.html"
 
 echo "FC_pregmod_$HASH.html compilation finished."
-- 
GitLab