octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: File found by searching load path


From: Przemek Klosowski
Subject: Re: File found by searching load path
Date: Tue, 11 Dec 2018 12:29:56 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1

On 12/10/18 3:33 PM, John W. Eaton wrote:
            load_path& lp =
               __get_load_path__ ("find_data_file_in_load_path");

             // Not directly found; search load path.
             std::string tmp
               = sys::env::make_absolute (lp.find_file (fname));

             if (! tmp.empty ())
               {
                 warn_data_file_in_path (fcn, tmp);

                 fname = tmp;
               }
           }

If the file is found through searching (! tmp.empty ()), add in another
test that the directory is not the same as OCTAVE_DATA_DIR.

To me, the situation is no different if the file is found in OCTAVE_DATA_DIR or somewhere else.  If I happen to have my own file penny.mat but am confused about what directory I'm in, I'd like that to be an error rather than silently loading Octave's penny.mat file.

It's fine with me if we disable the warning by default, but I'd like to keep it.

I think it's possible to find out the location of the file that was loaded:  file_in_loadpath(fname) should find the same file as sys::env::make_absolute (lp.find_file (fname)), right?

In that case, I would disable the warning for myself---but I couldn't figure out how; I thought it'd be

warning('off','Octave:load-file-in-path')

but no:

octave:11> load x
warning: load: '/tmp/x' found by searching load path


reply via email to

[Prev in Thread] Current Thread [Next in Thread]