From bug-request at octave dot org Thu Apr 6 09:26:28 2006 Subject: Re: addpath, rmpath, savepath From: "Robert S. Weigel" To: bug at octave dot org Date: Thu, 06 Apr 2006 09:25:34 -0500 It looks like we can satisfy all of the opinions voiced with a traditional_path_mode variable. If this new variable is acceptable, the plan is traditional_path_mode: '.' always on top and stripped from anywhere in LOADPATH and DEFAULT_LOADPATH on first call of addpath/rmpath. Calls to addpath/rmpath with '/path//' give warning that syntax is not allowed with traditional_path_mode=1; '/path' is added to the path. warn_matlab_incompatible: Warning when '.' is removed and when '//' is passed. Existing '//'s in path do not generate warning. all modes: Treat path with single trailing slash as identical to path with no trailing slash. No other changes to current behavior. I will submit a protototype of the above-defined addpath and rmpath on the weekend. >From my perspective, when dealing with system and directory functions it is worth the effort for cross-interpreter compatability. The reason is that this makes cross-platform compatability much less of a headache. Moreover, because making Octave relocatable involves tinkering with DEFAULT_LOADPATH, I think it is worth the effort to have as much flexibility as possible. Having developed many hacks to deal with the above (cross-platform, cross-interpreter, relocation) and work-arounds for cygwin-specific issues such as symlinks and network mounts, I think it is worth my effort now to allow others (and myself!) to have an easier time with such tasks in the future. (Having said all of this, in the long run perhaps the best place for dealing with platform/interpreter/interpreter versions/etc is in a compatability pack that works under both Matlab and Octave and defines a new addpath, rmpath, load, and save.) ________________________________________________________________ Side question: Should warn_matlab_incompatible only return warning if the called .m file (and its callees) is not in the Octave directory tree? For example, try warn_matlab_incompatible=1 rmpath('./') on Octave-2.9.5. Seems like only user-created functions should have a warning. Bob ------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.octave.org How to fund new projects: http://www.octave.org/funding.html Subscription information: http://www.octave.org/archive.html -------------------------------------------------------------