1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-08 20:42:28 +00:00

Add script for removing <CR> on windows.

This caused bad stuff to be generated on windows, specifically
the amalg file. We cause totally strip <CR> from files on windows
using this script.
This commit is contained in:
Calvin Rose
2019-09-12 23:18:52 -05:00
parent 0e99d8d80f
commit e6306ea188
3 changed files with 12 additions and 1 deletions

View File

@@ -9,4 +9,4 @@
# Body
(each path (tuple/slice (dyn :args) 1)
(print (slurp path)))
(print (slurp path :r)))

9
tools/removecr.janet Normal file
View File

@@ -0,0 +1,9 @@
# Remove carriage returns from file. Since piping things on
# windows may add bad line endings, we can just force removal
# with this script.
(def fname ((dyn :args) 1))
(with [f (file/open fname :rb+)]
(def source (:read f :all))
(def new-source (string/replace-all "\r" "" source))
(:seek f :set 0)
(:write f new-source))