mirror of https://github.com/buggins/dlangui.git
streams
This commit is contained in:
parent
fc57073d1a
commit
324dabb7be
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue