From c16c69c344b44a069b3a612702025b0513cd3058 Mon Sep 17 00:00:00 2001 From: Vadim Lopatin Date: Fri, 25 Aug 2017 17:58:23 +0300 Subject: [PATCH] trying to fix crash in FileDialog on failed opening of directory --- src/dlangui/dialogs/filedlg.d | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dlangui/dialogs/filedlg.d b/src/dlangui/dialogs/filedlg.d index ad49e196..bc92ee8f 100644 --- a/src/dlangui/dialogs/filedlg.d +++ b/src/dlangui/dialogs/filedlg.d @@ -264,9 +264,10 @@ class FileDialog : Dialog, CustomGridCellAdapter { try { _entries = listDirectory(dir, attrFilter, selectedFilter()); } catch(Exception e) { - import dlangui.dialogs.msgbox; - auto msgBox = new MessageBox(UIString.fromId("MESSAGE_ERROR"c), UIString.fromRaw(e.msg.toUTF32), window()); - msgBox.show(); + Log.e("Cannot list directory " ~ dir, e); + //import dlangui.dialogs.msgbox; + //auto msgBox = new MessageBox(UIString.fromId("MESSAGE_ERROR"c), UIString.fromRaw(e.msg.toUTF32), window()); + //msgBox.show(); return false; } _fileList.rows = 0; @@ -664,8 +665,10 @@ class FileDialog : Dialog, CustomGridCellAdapter { onItemSelected(row); }; - if (_path.empty) { + if (_path.empty || !_path.isDir) { _path = currentDir; + if (!_path.isDir) + _path = homePath; } openDirectory(_path, _filename); _fileList.layoutHeight = FILL_PARENT;