diff options
author | cooldome <cdome@bk.ru> | 2020-01-05 08:22:41 +0000 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-01-05 09:22:41 +0100 |
commit | a3df1b55f3537200ca23cfdea9e31a9a98deab06 (patch) | |
tree | 9af2fc42871e3a7823d8085b3343a3eff9879425 /lib/system | |
parent | 9474a818afa95f682d1255e74fae1681a2b4f1de (diff) | |
download | Nim-a3df1b55f3537200ca23cfdea9e31a9a98deab06.tar.gz |
fixes #13013, reverts previous changes to readLines() (#13036) [backport]
* Revert "remove default argument for readLines (#12807) [backport]" This reverts commit c949b81efdeb08b38224e1678ad140b7b7663b15.
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/io.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/system/io.nim b/lib/system/io.nim index e961b1bb2..4a1f9b84a 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -696,10 +696,10 @@ proc writeFile*(filename: string, content: openArray[byte]) {.since: (1, 1).} = else: raise newException(IOError, "cannot open: " & filename) -proc staticReadLines*(filename: string, n: Natural): seq[TaintedString] = - ## Compile time read `n` lines from the file named `filename`. Raises an IO exception +proc readLines*(filename: string, n: Natural): seq[TaintedString] = + ## read `n` lines from the file named `filename`. Raises an IO exception ## in case of an error. Raises EOF if file does not contain at least `n` lines. - ## A line of text may be delimited by ``LF`` or ``CRLF``. + ## Available at compile time. A line of text may be delimited by ``LF`` or ``CRLF``. ## The newline character(s) are not part of the returned strings. var f: File if open(f, filename): @@ -713,6 +713,8 @@ proc staticReadLines*(filename: string, n: Natural): seq[TaintedString] = else: sysFatal(IOError, "cannot open: " & filename) +proc readLines*(filename: string): seq[TaintedString] {.deprecated: "use readLines with two arguments".} = + readLines(filename, 1) iterator lines*(filename: string): TaintedString {.tags: [ReadIOEffect].} = ## Iterates over any line in the file named `filename`. |