diff options
author | Ganesh Viswanathan <dev@genotrance.com> | 2018-09-14 18:34:12 -0500 |
---|---|---|
committer | Ganesh Viswanathan <dev@genotrance.com> | 2018-09-14 18:34:12 -0500 |
commit | 9340885251e7791ee5a03f2b75e168f341e231e5 (patch) | |
tree | 86b4a189f01a1c114f5bb9e48d33e09a731953b0 /compiler/ropes.nim | |
parent | 4e305c304014c5ef90413d6cab562f5e2b34e573 (diff) | |
parent | b9dc486db15bb1b4b6f3cef7626733b904d377f7 (diff) | |
download | Nim-9340885251e7791ee5a03f2b75e168f341e231e5.tar.gz |
Merge remote-tracking branch 'upstream/devel' into test-7010
Diffstat (limited to 'compiler/ropes.nim')
-rw-r--r-- | compiler/ropes.nim | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/ropes.nim b/compiler/ropes.nim index 81ee01dbf..0d6d7d78f 100644 --- a/compiler/ropes.nim +++ b/compiler/ropes.nim @@ -58,6 +58,8 @@ import hashes +from pathutils import AbsoluteFile + type FormatStr* = string # later we may change it to CString for better # performance of the code generator (assignments @@ -183,9 +185,9 @@ proc writeRope*(f: File, r: Rope) = ## writes a rope to a file. for s in leaves(r): write(f, s) -proc writeRope*(head: Rope, filename: string): bool = +proc writeRope*(head: Rope, filename: AbsoluteFile): bool = var f: File - if open(f, filename, fmWrite): + if open(f, filename.string, fmWrite): if head != nil: writeRope(f, head) close(f) result = true @@ -314,16 +316,16 @@ proc equalsFile*(r: Rope, f: File): bool = result = readBuffer(f, addr(buf[0]), 1) == 0 and btotal == rtotal # check that we've read all -proc equalsFile*(r: Rope, filename: string): bool = +proc equalsFile*(r: Rope, filename: AbsoluteFile): bool = ## returns true if the contents of the file `f` equal `r`. If `f` does not ## exist, false is returned. var f: File - result = open(f, filename) + result = open(f, filename.string) if result: result = equalsFile(r, f) close(f) -proc writeRopeIfNotEqual*(r: Rope, filename: string): bool = +proc writeRopeIfNotEqual*(r: Rope, filename: AbsoluteFile): bool = # returns true if overwritten if not equalsFile(r, filename): result = writeRope(r, filename) |