Add slightly nicer failure message to io.rs when it can't open a file.

This commit is contained in:
Graydon Hoare 2011-03-20 19:42:51 -07:00
parent c4e0085291
commit 460d89156f

View File

@ -108,7 +108,10 @@ fn stdin() -> reader {
fn file_reader(str path) -> reader {
auto f = os.libc.fopen(_str.buf(path), _str.buf("r"));
check (f as uint != 0u);
if (f as uint == 0u) {
log "error opening " + path;
fail;
}
ret FILE_reader(f, true);
}