Commit 2219a534897bba640e0bda6a63bb4352d53d2e5b

Authored by totoro
1 parent bb25ec02

copy_file_and_convert_to_CRLF can keep the original file instead of delete it.

Showing 1 changed file with 16 additions and 3 deletions   Show diff stats
string/crlf.anubis
... ... @@ -101,13 +101,26 @@ public define ResultCopy
101 101 copy_file_and_convert_to_CRLF
102 102 (
103 103 String file,
104   - ByteArray -> ByteArray converter
  104 + ByteArray -> ByteArray converter,
  105 + Bool keep_org
105 106 )=
106 107 if rename(file, file+".tmp") then
107 108 with result = copy_file_and_convert_to_CRLF(file+".tmp", file, converter),
108   - forget(remove(file+".tmp"));
  109 + (if keep_org then
  110 + unique
  111 + else
  112 + forget(remove(file+".tmp")));
109 113 result
110 114 else
111   - cant_create_file.
  115 + cant_create_file
  116 +.
112 117  
113 118  
  119 +public define ResultCopy
  120 + copy_file_and_convert_to_CRLF
  121 + (
  122 + String file,
  123 + ByteArray -> ByteArray converter
  124 + )=
  125 + copy_file_and_convert_to_CRLF(file, converter, false)
  126 +.
... ...