fixed colors module

This commit is contained in:
Andreas Rumpf 2010-03-02 21:39:23 +01:00
commit 6c08ba8290
3 changed files with 142 additions and 150 deletions

View file

@ -1140,4 +1140,19 @@ proc sleep*(milsecs: int) =
a.tv_nsec = (milsecs mod 1000) * 1000
discard posix.nanosleep(a, b)
proc getFileSize*(file: string): biggestInt =
## returns the file size of `file`. Can raise ``EOS``.
when defined(windows):
var a: TWin32FindData
var resA = findfirstFileA(file, a)
if resA == -1: OSError()
result = rdFileSize(a)
findclose(resA)
else:
var f: TFile
if open(f, file):
result = getFileSize(f)
close(f)
else: OSError()
{.pop.}