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) {
|
bool load(string filename) {
|
||||||
clear();
|
clear();
|
||||||
try {
|
try {
|
||||||
InputStream f = new FileInputStream(filename);
|
InputStream f;
|
||||||
|
f = new FileInputStream(filename);
|
||||||
scope(exit) { f.close(); }
|
scope(exit) { f.close(); }
|
||||||
return load(f, filename);
|
bool res = load(f, filename);
|
||||||
|
return res;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("Exception while trying to read file ", filename, " ", e.toString);
|
Log.e("Exception while trying to read file ", filename, " ", e.toString);
|
||||||
clear();
|
clear();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,8 @@ class FileInputStream : InputStream {
|
||||||
_file = std.stdio.File(filename, "rb");
|
_file = std.stdio.File(filename, "rb");
|
||||||
}
|
}
|
||||||
void close() {
|
void close() {
|
||||||
_file.close();
|
if (isOpen)
|
||||||
|
_file.close();
|
||||||
}
|
}
|
||||||
size_t read(ubyte[] buffer) {
|
size_t read(ubyte[] buffer) {
|
||||||
ubyte[] res = _file.rawRead(buffer);
|
ubyte[] res = _file.rawRead(buffer);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue