From cdeef302d8b7a2bb5b3f1d4f8fb7d20d994f6e39 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Wed, 22 Apr 2020 13:54:09 -0700
Subject: [PATCH] Concatenate javascript files in binary mode so Windows
 doesn't try to fuck with the codepage

---
 compile.bat              | 2 +-
 devTools/concatFiles.bat | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/compile.bat b/compile.bat
index 2a06b08270c..d91b67280d6 100644
--- a/compile.bat
+++ b/compile.bat
@@ -4,7 +4,7 @@
 :: Set working directory
 pushd %~dp0
 if not exist "bin\resources" mkdir bin\resources
-CALL devTools/concatFiles.bat js/ "*.js" bin/fc.js
+CALL devTools/concatFiles.bat js\ "*.js" bin\fc.js
 :: Run the appropriate compiler for the user's CPU architecture.
 if %PROCESSOR_ARCHITECTURE% == AMD64 (
 	CALL "%~dp0devTools\tweeGo\tweego_win64.exe" -o "%~dp0bin/FC_pregmod.html" --module=bin/fc.js --head devTools/head.html "%~dp0src"
diff --git a/devTools/concatFiles.bat b/devTools/concatFiles.bat
index cce8129af35..3da9527a846 100644
--- a/devTools/concatFiles.bat
+++ b/devTools/concatFiles.bat
@@ -2,12 +2,13 @@
 :: Concatenates files from dir %1 specified with wildcard %2 and outputs result to %3
 
 :: TODO Proper temp file instead of bin\list.txt
+IF EXIST %3 DEL %3
 SET _LISTFILE="bin\list.txt"
 >%_LISTFILE% (FOR /R "%~1" %%F IN (%2) DO echo "%%F")
 sort /O %_LISTFILE% %_LISTFILE%
->%3 (FOR /F "usebackq delims=" %%F IN (`type "%_LISTFILE%"`) DO (
-	echo /* %%F */
-	type %%F
+(FOR /F "usebackq delims=" %%F IN (`type "%_LISTFILE%"`) DO (
+	echo /* %%F */ >> %3
+	copy /b %3+%%F %3 1>NUL
 	)
 )
 
-- 
GitLab