Mercurial > octave-libgccjit
changeset 18607:40dce9423baa gui-release
uigetdir: return correct path name (Bug #42004)
* libgui/src/dialog.cc
(FileDialog::accept): When in dir mode, get the full path name from the selected file.
author | John Donoghue <john.donoghue@ieee.org> |
---|---|
date | Sun, 30 Mar 2014 20:18:18 -0400 |
parents | 400f48e9e8cb |
children | 6e81b59d657c |
files | libgui/src/dialog.cc |
diffstat | 1 files changed, 11 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/src/dialog.cc Sun Mar 30 13:00:36 2014 -0700 +++ b/libgui/src/dialog.cc Sun Mar 30 20:18:18 2014 -0400 @@ -485,23 +485,25 @@ string_result = selectedFiles (); + if (testOption (QFileDialog::ShowDirsOnly) == true && + string_result.size () > 0) + { + path = string_result[0]; + } + else + { + path = directory ().absolutePath (); + } + // Matlab expects just the file name, whereas the file dialog gave us - // pull path names, so fix it. + // full path names, so fix it. for (int i = 0; i < string_result.size (); i++) string_result[i] = QFileInfo (string_result[i]).fileName (); - path = directory ().absolutePath (); - // if not showing only dirs, add end slash for the path component if (testOption (QFileDialog::ShowDirsOnly) == false) path = path + "/"; - else - { - // if name was provided in uigetdir, add to path - if (string_result.size() > 0) - path = path + "/" + string_result[0]; - } // convert to native slashes path = QDir::toNativeSeparators (path);