changeset 19774:ca6fc882177d

Fix working directory of Figure Save dialog between CLI and GUI (bug #44175). * uiputfile.m: Check for a directory before calling fileparts which automatically assumes the last element is a file. * __add_default_menu__.m: Use default filename "untitled.pdf" for saving FLTK figures.
author Rik <rik@octave.org>
date Tue, 17 Feb 2015 15:24:05 -0800
parents 3fa35defe495
children b8e4104a8f55
files scripts/gui/uiputfile.m scripts/plot/util/private/__add_default_menu__.m
diffstat 2 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/gui/uiputfile.m	Tue Feb 17 13:34:32 2015 -0800
+++ b/scripts/gui/uiputfile.m	Tue Feb 17 15:24:05 2015 -0800
@@ -94,7 +94,12 @@
 
   if (nargin > 2)
     if (ischar (varargin{3}))
-      [fdir, fname, fext] = fileparts (varargin{3});
+      if (isdir (varargin{3}))
+        fdir = varargin{3};
+        fname = fext = "";
+      else
+        [fdir, fname, fext] = fileparts (varargin{3});
+      endif
       if (! isempty (fdir))
         outargs{6} = fdir;
       endif
--- a/scripts/plot/util/private/__add_default_menu__.m	Tue Feb 17 13:34:32 2015 -0800
+++ b/scripts/plot/util/private/__add_default_menu__.m	Tue Feb 17 15:24:05 2015 -0800
@@ -76,7 +76,7 @@
   [filename, filedir] = uiputfile ({"*.pdf;*.ps;*.gif;*.png;*.jpg",
                                     "Supported Graphic Formats"},
                                    "Save Figure",
-                                   pwd);
+                                   [pwd, filesep, "untitled.pdf"]);
   if (filename != 0)
     fname = [filedir filesep() filename];
     obj = findall (gcbf, "label", "&Save");