changeset 11289:f44c47959256

uifilefun fixes
author Kai Habel <kai.habel@gmx.de>
date Mon, 22 Nov 2010 21:13:15 +0100
parents c5e6efdbcf67
children 646063a22a35
files scripts/ChangeLog scripts/plot/private/__fltk_file_filter__.m scripts/plot/uigetdir.m
diffstat 3 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-21  Kai Habel  <kai.habel@gmx.de>
+
+	* (plot/uigetdir.m, plot/private/__fltk_file_filter__.m:): Check if
+	file argument is a valid path, don't use fileparts in this case.
+
 2010-11-21  Ben Abbott  <bpabbott@mac.com>
 
 	* plot/__go_draw_axes__.m: Fix plot titles so they are visible for
--- a/scripts/plot/private/__fltk_file_filter__.m
+++ b/scripts/plot/private/__fltk_file_filter__.m
@@ -25,6 +25,7 @@
 
 function retval = __fltk_file_filter__ (file_filter)
   # converts octave's file filter format into fltk's.
+  retval = "";
   if (iscell (file_filter))
     [r, c] = size (file_filter);
     if ((c == 0) || (c > 2))
@@ -61,10 +62,11 @@
     endfor
     retval = fltk_str;
   elseif (ischar (file_filter))
-    outargs{3} = file_filter;
-    [fdir, fname, fext] = fileparts (file_filter);
-    if (length (fext) > 0)
-      retval = strcat ("*", fext, "\t*");
+    if (!isdir (file_filter))
+      [fdir, fname, fext] = fileparts (file_filter);
+      if (length (fext) > 0)
+        retval = strcat ("*", fext, "\t*");
+      endif
     endif
   endif  
 endfunction
--- a/scripts/plot/uigetdir.m
+++ b/scripts/plot/uigetdir.m
@@ -38,7 +38,9 @@
   endif
 
   if (any (cellfun(@(x)strcmp (x, "fltk"), available_backends)))
-      init_path = fileparts (init_path);
+      if (!isdir (init_path))
+        init_path = fileparts (init_path);
+      endif
       retdir = __fltk_uigetfile__ ("", name, init_path, [240, 120], "dir");
   else
     error ("uigetdir requires fltk backend.");