remove system.getFileSize again, breaks windows builds and I don't want more stuff that's a pain to support in a platform independent manner
This commit is contained in:
parent
27ede21504
commit
6eb74c7281
2 changed files with 0 additions and 10 deletions
|
|
@ -2895,9 +2895,6 @@ when not defined(JS): #and not defined(nimscript):
|
||||||
proc getFileSize*(f: File): int64 {.tags: [ReadIOEffect], benign.}
|
proc getFileSize*(f: File): int64 {.tags: [ReadIOEffect], benign.}
|
||||||
## retrieves the file size (in bytes) of `f`.
|
## retrieves the file size (in bytes) of `f`.
|
||||||
|
|
||||||
proc setFileSize*(f: File, size: int64) {.tags: [ReadIOEffect], benign.}
|
|
||||||
## changes the size of file `f` (in bytes).
|
|
||||||
|
|
||||||
proc readBytes*(f: File, a: var openArray[int8|uint8], start, len: Natural): int {.
|
proc readBytes*(f: File, a: var openArray[int8|uint8], start, len: Natural): int {.
|
||||||
tags: [ReadIOEffect], benign.}
|
tags: [ReadIOEffect], benign.}
|
||||||
## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns
|
## reads `len` bytes into the buffer `a` starting at ``a[start]``. Returns
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,6 @@ proc c_ferror(f: File): cint {.
|
||||||
importc: "ferror", header: "<stdio.h>", tags: [].}
|
importc: "ferror", header: "<stdio.h>", tags: [].}
|
||||||
proc c_setvbuf(f: File, buf: pointer, mode: cint, size: csize): cint {.
|
proc c_setvbuf(f: File, buf: pointer, mode: cint, size: csize): cint {.
|
||||||
importc: "setvbuf", header: "<stdio.h>", tags: [].}
|
importc: "setvbuf", header: "<stdio.h>", tags: [].}
|
||||||
proc c_ftruncate(f: FileHandle, len: clong): cint {.
|
|
||||||
importc: "ftruncate", header: "<unistd.h>".}
|
|
||||||
|
|
||||||
proc raiseEIO(msg: string) {.noinline, noreturn.} =
|
proc raiseEIO(msg: string) {.noinline, noreturn.} =
|
||||||
sysFatal(IOError, msg)
|
sysFatal(IOError, msg)
|
||||||
|
|
@ -375,11 +373,6 @@ proc getFileSize(f: File): int64 =
|
||||||
result = getFilePos(f)
|
result = getFilePos(f)
|
||||||
setFilePos(f, oldPos)
|
setFilePos(f, oldPos)
|
||||||
|
|
||||||
proc setFileSize(f: File, size: int64) =
|
|
||||||
## Set a file length.
|
|
||||||
if c_ftruncate(getFileHandle f, size.clong) == -1:
|
|
||||||
raiseEIO("cannot truncate file")
|
|
||||||
|
|
||||||
proc readFile(filename: string): TaintedString =
|
proc readFile(filename: string): TaintedString =
|
||||||
var f: File
|
var f: File
|
||||||
if open(f, filename):
|
if open(f, filename):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue