mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-10 05:38:10 +00:00
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:
@@ -2895,9 +2895,6 @@ when not defined(JS): #and not defined(nimscript):
|
||||
proc getFileSize*(f: File): int64 {.tags: [ReadIOEffect], benign.}
|
||||
## 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 {.
|
||||
tags: [ReadIOEffect], benign.}
|
||||
## 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: [].}
|
||||
proc c_setvbuf(f: File, buf: pointer, mode: cint, size: csize): cint {.
|
||||
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.} =
|
||||
sysFatal(IOError, msg)
|
||||
@@ -375,11 +373,6 @@ proc getFileSize(f: File): int64 =
|
||||
result = getFilePos(f)
|
||||
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 =
|
||||
var f: File
|
||||
if open(f, filename):
|
||||
|
||||
Reference in New Issue
Block a user