diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system/inclrtl.nim | 4 | ||||
-rw-r--r-- | lib/system/io.nim | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/system/inclrtl.nim b/lib/system/inclrtl.nim index 4193f2bdd..6bff819e6 100644 --- a/lib/system/inclrtl.nim +++ b/lib/system/inclrtl.nim @@ -48,3 +48,7 @@ when defined(nimlocks): {.pragma: benign, gcsafe, locks: 0.} else: {.pragma: benign, gcsafe.} + +template since(version, body: untyped) {.dirty.} = + when version <= (NimMajor, NimMinor): + body diff --git a/lib/system/io.nim b/lib/system/io.nim index fcdfa79c0..7010a7fdb 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -685,7 +685,7 @@ proc writeFile*(filename, content: string) {.tags: [WriteIOEffect], benign.} = else: sysFatal(IOError, "cannot open: " & filename) -proc writeFile*(filename: string, content: openArray[byte]) = +proc writeFile*(filename: string, content: openArray[byte]) {.since: (1, 1).} = ## Opens a file named `filename` for writing. Then writes the ## `content` completely to the file and closes the file afterwards. ## Raises an IO exception in case of an error. |