This commit is contained in:
Vadim Lopatin 2016-10-11 15:12:31 +03:00
parent fc57073d1a
commit 324dabb7be
2 changed files with 6 additions and 3 deletions

View File

@ -1420,9 +1420,11 @@ class EditableContent {
bool load(string filename) {
clear();
try {
InputStream f = new FileInputStream(filename);
InputStream f;
f = new FileInputStream(filename);
scope(exit) { f.close(); }
return load(f, filename);
bool res = load(f, filename);
return res;
} catch (Exception e) {
Log.e("Exception while trying to read file ", filename, " ", e.toString);
clear();

View File

@ -22,7 +22,8 @@ class FileInputStream : InputStream {
_file = std.stdio.File(filename, "rb");
}
void close() {
_file.close();
if (isOpen)
_file.close();
}
size_t read(ubyte[] buffer) {
ubyte[] res = _file.rawRead(buffer);