[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
load function doesn't check path
From: |
John W. Eaton |
Subject: |
load function doesn't check path |
Date: |
Mon, 13 Nov 2006 16:18:03 -0500 |
On 13-Nov-2006, Frederick (Rick) A Niles wrote:
| I'm sure this is a FAQ, but it seems the "load" function in Octave
| doesn't check the "path" that's used for functions.
|
| I've noticed a lot of MATLAB code that relies on this behavior. Is this
| something that will change in the future?
In
http://velveeta.che.wisc.edu/octave/lists/help-octave/2004/2134
I wrote:
Yes, it is intentional, because it seemed to me that looking in the
LOADPATH for files to open could easily lead to a lot of confusion and
possibly bad science if you thought you were opening one file and
happened to find another somewhere on the path.
Perhaps we should fix this for compatibility. If we do, then I
propose that we have Octave issue a warning if the file is found on
the load path rather than by using the supplied name.
If you must find data files on the load path with the current version
of Octave, you might try using the function
file_in_loadpath
to search for you before calling fopen.
This message was about fopen, which also searches MATLABPATH in
Matlab, but it also applies to load.
So, should we search the load path? Is a warning acceptable if the
file is not an absolute filename and it is also not found in the
current directory? I suppose the warning should be disabled at
startup if --traditional is used.
jwe