memfiles now uses winlean; changed the interface to raise EOS

This commit is contained in:
Araq 2011-11-05 12:16:49 +01:00
commit dc08a033d9
8 changed files with 123 additions and 70 deletions

View file

@ -632,7 +632,10 @@ proc newRodReader(modfilename: string, crc: TCrc32,
r.readerIndex = readerIndex
r.filename = modfilename
InitIdTable(r.syms)
if not open(r.memFile, modfilename): return nil
try:
r.memFile = memfiles.open(modfilename)
except EOS:
return nil
# we terminate the file explicitely with ``\0``, so the cast to `cstring`
# is save:
r.s = cast[cstring](r.memFile.mem)