mirror of https://github.com/buggins/dlangui.git
catch editable load exception
This commit is contained in:
parent
131a505ab3
commit
27dc097981
|
@ -1423,14 +1423,22 @@ class EditableContent {
|
||||||
/// load content from file
|
/// load content from file
|
||||||
bool load(string filename) {
|
bool load(string filename) {
|
||||||
clear();
|
clear();
|
||||||
|
if (!filename.exists || !filename.isFile) {
|
||||||
|
Log.e("Editable.load: File not found ", filename);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
InputStream f;
|
InputStream f;
|
||||||
f = new FileInputStream(filename);
|
f = new FileInputStream(filename);
|
||||||
scope(exit) { f.close(); }
|
scope(exit) { f.close(); }
|
||||||
bool res = load(f, filename);
|
bool res = load(f, filename);
|
||||||
return res;
|
return res;
|
||||||
|
} catch (ErrnoException e) {
|
||||||
|
Log.e("Editable.load: Exception while trying to read file ", filename, " ", e.toString);
|
||||||
|
clear();
|
||||||
|
return false;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e("Exception while trying to read file ", filename, " ", e.toString);
|
Log.e("Editable.load: Exception while trying to read file ", filename, " ", e.toString);
|
||||||
clear();
|
clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue