changeset 22359:929a1500907e

uigetfile.m: fix type and allow path names as input arg (bug #48828) * uigetfile.m: add stanza about path name / directory name in texinfo header * private/__file_filter__.m: fix typo; check for empty retval before indexing it
author Philip Nienhuis <prnienhuis@users.sf.net>
date Fri, 19 Aug 2016 17:01:19 +0200
parents dc73bbd66363
children 7849a627c40d
files scripts/gui/private/__file_filter__.m scripts/gui/uigetfile.m
diffstat 2 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/gui/private/__file_filter__.m	Mon Aug 22 13:47:50 2016 -0700
+++ b/scripts/gui/private/__file_filter__.m	Fri Aug 19 17:01:19 2016 +0200
@@ -1,4 +1,4 @@
-## Copyright (C) 2010-2016 Kai Habel
+## Copyright (C) 2010-2015 Kai Habel
 ##
 ## This file is part of Octave.
 ##
@@ -26,7 +26,7 @@
 function [retval, defname, defdir] = __file_filter__ (caller, file_filter)
 
   #keyboard;
-  revtal = {};
+  retval = {};
   defname = "";
   defdir = "";
 
@@ -63,7 +63,9 @@
   endif
 
   ## Delete any "*.*" pattern, and add "* All Files"
-  retval(strcmp (retval(1,:), "*.*"), :) = [];
+  if (! isempty (retval))
+    retval(strcmp (retval(1,:), "*.*"), :) = [];
+  endif
   retval(end+1,:) = {"*", __default_filtername__("*")};
 
 endfunction
--- a/scripts/gui/uigetfile.m	Mon Aug 22 13:47:50 2016 -0700
+++ b/scripts/gui/uigetfile.m	Fri Aug 19 17:01:19 2016 +0200
@@ -49,6 +49,16 @@
 ## extensions.
 ## Example: @code{uigetfile (@{"*.gif;*.png;*.jpg", "Supported Picture
 ## Formats"@})}
+##
+## @item A directory name or path name
+## If the folder name of path name contains a trailing file separator, the
+## contents of that folder will be displayed.  If no trailing file separator
+## is present the parent directory is listed.  The substring to the right of
+## the rightmost file separator (if any) will be interpreted as a file or
+## directory name and if that file or directory exists it will be highlighted.
+## If the path name or directory name is wholly or partly nonexistent, the
+## current working directory will be displayed.
+## No filter will be active.
 ## @end table
 ##
 ## @var{dialog_name} can be used to customize the dialog title.