Mercurial > octave
changeset 21841:cf690a73a186
uiputfile.m: Correctly handle '*.*' filter type (bug #48182).
* uiputfile.m: Only append extension if it is not present in filename,
but was specified in filter. Detect special case of '*.*' and avoid
adding '.' as extension.
author | Rik <rik@octave.org> |
---|---|
date | Wed, 08 Jun 2016 14:48:12 -0700 |
parents | f382293bc11d |
children | 7da4671f3a5b |
files | scripts/gui/uiputfile.m |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/gui/uiputfile.m Sat May 28 17:48:39 2016 +1000 +++ b/scripts/gui/uiputfile.m Wed Jun 08 14:48:12 2016 -0700 @@ -116,11 +116,12 @@ ## Append extension to the name if it isn't already added. if (ischar (retfile)) - ext = outargs{1}{retindex}; - ext = strrep (ext, "*", ""); - - if (length (retfile) >= length (ext)) - if (! strcmp (retfile(end-length (ext)+1:end), ext)) + [~, ~, ext] = fileparts (retfile); + if (isempty (ext)) + ext = outargs{1}{retindex}; + ext = strrep (ext, "*", ""); + if (ext != '.') + [~, ~, ext] = fileparts (ext); # paranoid checking of extension retfile = [retfile ext]; endif endif