diff libinterp/corefcn/file-io.cc @ 19064:9ef10e6a5987

make "file found in path" warnings consistent * gripes.h, gripes.cc (gripe_data_file_in_path): New function. * utils.h, utils.cc (find_data_file_in_path): New function. Use gripe_data_file_in_path to warn. * file-io.cc (do_stream_open): Call find_data_file_in_path to search path for file. * load-save.cc (find_file_to_load): Likewise. * md5sum.cc (Fmd5sum): Likewise. * octave.cc (maximum_braindamage): Disable new Octave:data-file-in-path warning ID instead of Octave:fopen-file-in-path and Octave:load-file-in-path. * NEWS: Note change.
author John W. Eaton <jwe@octave.org>
date Tue, 19 Aug 2014 06:40:53 -0400
parents ed3cb9f81145
children e90bfaadb489
line wrap: on
line diff
--- a/libinterp/corefcn/file-io.cc	Mon Aug 18 20:46:07 2014 -0700
+++ b/libinterp/corefcn/file-io.cc	Tue Aug 19 06:40:53 2014 -0400
@@ -500,23 +500,8 @@
 
           file_stat fs (fname);
 
-          if (! (md & std::ios::out
-                 || octave_env::absolute_pathname (fname)
-                 || octave_env::rooted_relative_pathname (fname)))
-            {
-              if (! fs.exists ())
-                {
-                  std::string tmp
-                    = octave_env::make_absolute (load_path::find_file (fname));
-
-                  if (! tmp.empty ())
-                    {
-                      warning_with_id ("Octave:fopen-file-in-path",
-                                       "fopen: file found in load path");
-                      fname = tmp;
-                    }
-                }
-            }
+          if (! (md & std::ios::out))
+            fname = find_data_file_in_load_path ("fopen", fname);
 
           if (! fs.is_dir ())
             {