Mercurial > hg > octave-nkf
changeset 10646:6c50b56824aa
file_in_path, file_in_loadpath: return empty string instead of empty matrix if file not found
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 May 2010 12:19:45 -0400 |
parents | 8645b7087859 |
children | 5c6b73a844e4 |
files | src/ChangeLog src/utils.cc |
diffstat | 2 files changed, 9 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2010-05-20 John W. Eaton <jwe@octave.org> + + * 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 <highegg@gmail.com> * DLD-FUNCTIONS/onCleanup.cc (octave_oncleanup::load_ascii,
--- a/src/utils.cc +++ b/src/utils.cc @@ -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 ();