# HG changeset patch # User John W. Eaton # Date 1274372385 14400 # Node ID 6c50b56824aa3aaff6dc1331a071eed4d5fb0913 # Parent 8645b7087859e741eb3ef9dd0a69ae49ddc82cb1 file_in_path, file_in_loadpath: return empty string instead of empty matrix if file not found diff -r 8645b7087859 -r 6c50b56824aa src/ChangeLog --- a/src/ChangeLog Thu May 20 15:10:34 2010 +0200 +++ b/src/ChangeLog Thu May 20 12:19:45 2010 -0400 @@ -1,3 +1,8 @@ +2010-05-20 John W. Eaton + + * utils.cc (Ffile_in_path, Ffile_in_loadpath): If no file is + found, return empty character string instead of empty matrix. + 2010-05-20 Jaroslav Hajek * DLD-FUNCTIONS/onCleanup.cc (octave_oncleanup::load_ascii, diff -r 8645b7087859 -r 6c50b56824aa src/utils.cc --- a/src/utils.cc Thu May 20 15:10:34 2010 +0200 +++ b/src/utils.cc Thu May 20 12:19:45 2010 -0400 @@ -279,7 +279,7 @@ \n\ Return the absolute name of @var{file} if it can be found in\n\ the list of directories specified by @code{path}.\n\ -If no file is found, return an empty matrix.\n\ +If no file is found, return an empty character string.\n\ \n\ If the first argument is a cell array of strings, search each\n\ directory of the loadpath for element of the cell array and return\n\ @@ -302,15 +302,7 @@ if (! error_state && names.length () > 0) { if (nargin == 1) - { - std::string fname - = octave_env::make_absolute (load_path::find_first_of (names)); - - if (fname.empty ()) - retval = Matrix (); - else - retval = fname; - } + retval = octave_env::make_absolute (load_path::find_first_of (names)); else if (nargin == 2) { std::string opt = args(1).string_value (); @@ -338,7 +330,7 @@ Return the absolute name of @var{file} if it can be found in\n\ @var{path}. The value of @var{path} should be a colon-separated list of\n\ directories in the format described for @code{path}. If no file\n\ -is found, return an empty matrix. For example,\n\ +is found, return an empty character string. For example,\n\ \n\ @example\n\ @group\n\ @@ -372,14 +364,7 @@ if (! error_state && names.length () > 0) { if (nargin == 2) - { - std::string fname = search_path_for_file (path, names); - - if (fname.empty ()) - retval = Matrix (); - else - retval = fname; - } + retval = search_path_for_file (path, names); else if (nargin == 3) { std::string opt = args(2).string_value ();