status-im/nim-stew

io2 readAllBytes / readAllFile does not work at compile time

Opened this issue · 1 comments

kdeme commented

Using readAllBytes / readAllFile / ... or rather the underlying readFile cannot be used at compile time because of usage of toOpenArray.
Hitting practically this issue: nim-lang/Nim#19969

Circumventing the usage of toOpenArray makes you then hit:

`/nim-stew/stew/io2.nim(1220, 21) Error: cannot 'importc' variable at compile time; stat`

Which has to do with posix.stat usage for getting the file size.

I realize that these are more Nim issues than nim-stew/io2 issues, but still creating an issue here to track, as because of this I end up working around it by still using std/io its readFile. (Same appears to have been done in nimbus-eth2).