diff libinterp/corefcn/variables.cc @ 18960:cc8aaf9c9e33

exist: don't search path for absolute or rooted relative file names * load-path.cc (load_path::do_find_file): If file name is absolute or rooted relative simply check for existence of file. * variables.cc: New tests.
author John W. Eaton <jwe@octave.org>
date Wed, 16 Jul 2014 18:38:55 -0400
parents ca0d9844dfd7
children fa48651fbb8a
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Tue Jul 15 22:18:35 2014 +0200
+++ b/libinterp/corefcn/variables.cc	Wed Jul 16 18:38:55 2014 -0400
@@ -663,6 +663,16 @@
 %!error <TYPE must be a string> exist ("a", 1)
 %!error <NAME must be a string> exist (1)
 
+%!test
+%! flist = dir ();
+%! fname = flist(3).name;  ## skip . and ..
+%! assert (exist (fullfile (pwd (), fname), "file"), 2)
+%! assert (exist (fullfile (pwd (), "nonexistentfile"), "file"), 0)
+
+%!assert (exist ("plot.m", "file"), 2);
+%!assert (exist ("./plot.m", "file"), 0);
+%!assert (exist ("./nonexistentfile", "file"), 0);
+%!assert (exist ("nonexistentfile", "file"), 0);
 */
 
 octave_value