From 5bf9e4fc89e469eb85f4cb604aac4f315688bdb2 Mon Sep 17 00:00:00 2001 From: Calvin Rose Date: Sat, 26 Jan 2019 17:17:56 -0500 Subject: [PATCH] Make amalg tool windows friendly Convert / to \ in file paths for windows. --- tools/amalg.janet | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/amalg.janet b/tools/amalg.janet index 4a3abe14..59e104a1 100644 --- a/tools/amalg.janet +++ b/tools/amalg.janet @@ -3,6 +3,14 @@ (def {:year YY :month MM :month-day DD} (os/date)) +(defn dofile + "Print one file to stdout" + [path] + (def path (if (= (os/which) :windows) + (string/replace "/" "\\" path) + path)) + (print (slurp path))) + # Order is important here, as some headers # depend on other headers. (def headers @@ -63,8 +71,8 @@ (print ```#define JANET_AMALG #include "janet.h"```) -(each h headers (print (slurp h))) -(each s sources (print (slurp s))) +(each h headers (dofile h)) +(each s sources (dofile s)) # Relies on this file being built -(print (slurp "build/core.gen.c")) +(dofile "build/core.gen.c")