From 2219a534897bba640e0bda6a63bb4352d53d2e5b Mon Sep 17 00:00:00 2001 From: totoro Date: Sat, 18 Feb 2017 18:28:51 +0100 Subject: [PATCH] copy_file_and_convert_to_CRLF can keep the original file instead of delete it. --- string/crlf.anubis | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/string/crlf.anubis b/string/crlf.anubis index 503358a..4c7b2cd 100644 --- a/string/crlf.anubis +++ b/string/crlf.anubis @@ -101,13 +101,26 @@ public define ResultCopy copy_file_and_convert_to_CRLF ( String file, - ByteArray -> ByteArray converter + ByteArray -> ByteArray converter, + Bool keep_org )= if rename(file, file+".tmp") then with result = copy_file_and_convert_to_CRLF(file+".tmp", file, converter), - forget(remove(file+".tmp")); + (if keep_org then + unique + else + forget(remove(file+".tmp"))); result else - cant_create_file. + cant_create_file +. +public define ResultCopy + copy_file_and_convert_to_CRLF + ( + String file, + ByteArray -> ByteArray converter + )= + copy_file_and_convert_to_CRLF(file, converter, false) +. -- libgit2 0.21.4