Fix FileDialog for saving in non-existing filenames issue #321

This commit is contained in:
and3md 2017-05-06 22:26:07 +02:00
parent ae1af989c9
commit 8eb9737be5
1 changed files with 3 additions and 3 deletions

View File

@ -480,7 +480,7 @@ class FileDialog : Dialog, CustomGridCellAdapter {
auto baseFilename = toUTF8(_edFilename.text); auto baseFilename = toUTF8(_edFilename.text);
_filename = _path ~ dirSeparator ~ baseFilename; _filename = _path ~ dirSeparator ~ baseFilename;
if (action.id != StandardAction.OpenDirectory && isDir(_filename)) { if (action.id != StandardAction.OpenDirectory && exists(_filename) && isDir(_filename)) {
auto row = _fileList.row(); auto row = _fileList.row();
onItemActivated(row); onItemActivated(row);
return true; return true;
@ -488,9 +488,9 @@ class FileDialog : Dialog, CustomGridCellAdapter {
Action result = _action; Action result = _action;
result.stringParam = _filename; result.stringParam = _filename;
// success if either selected dir & has to open dir or if selected file // success if either selected dir & has to open dir or if selected file
if (action.id == StandardAction.OpenDirectory && isDir(_filename) || if (action.id == StandardAction.OpenDirectory && exists(_filename) && isDir(_filename) ||
action.id == StandardAction.Save && !(_flags & FileDialogFlag.FileMustExist) || action.id == StandardAction.Save && !(_flags & FileDialogFlag.FileMustExist) ||
isFile(_filename)) { exists(_filename) && isFile(_filename)) {
close(result); close(result);
return true; return true;
} }