diff options
Diffstat (limited to 'src/library.js')
-rw-r--r-- | src/library.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js index e3b6f964..eaa2332d 100644 --- a/src/library.js +++ b/src/library.js @@ -290,7 +290,14 @@ var Library = { }, open: function(filename) { var stream = _STDIO.filenames[filename]; - if (!stream) return -1; // assert(false, 'No information for file: ' + filename); + if (!stream) { + // Not already cached; try to load it right now + try { + return _STDIO.prepare(filename, readBinary(filename)); + } catch(e) { + return 0; + } + } var info = _STDIO.streams[stream]; info.position = info.error = info.eof = 0; return stream; |