~/.octaverc overwrites OCTAVE_PATH!!

Ben Abbott bpabbott at mac.com
Sun Dec 21 18:57:38 CST 2008


On Dec 21, 2008, at 3:38 PM, Rosen Diankov wrote:

> Hi all,
>
> I'm trying to append my own directory with octave files
> (/usr/local/myoctavefiles) to the automatically set octave paths. At
> first, I tried doing
>
> export OCTAVE_PATH=/usr/local/myoctavefiles
>
> but it didn't work since the auto-generated ~/.octaverc file (from
> savepath) overwrites any added paths via the path function. Ie, the
> ~/.octaverc file looks like:
>
> ## Begin savepath auto-created section, do not edit
>  path ('/usr/local/share/...',...)
> ## End savepath auto-created section
>
> So the next obvious thing to do was to call
> addpath('/usr/local/myoctavefiles') right after the '## End savepath
> ...', but this has a very dangerous side-effect. The problem is that
> the next time the user calls 'savepath', it will put
> /usr/local/myoctavefiles inside the auto-generated code. And even if I
> remove my addpath or set OCTAVE_PATH to something different, my path
> will remain added to the octave path!
>
> So I propose a small savepath change that always puts
> getenv('OCTAVE_PATH') inside the auto-generated code.
> It would be great if this makes it into octave 3.0.4
>
> thank you,
> rosen diankov

If I understand you correctly you'd like to be able to dynamically add  
a specific path when octave is run. Have you looked at the command  
line options. For example,

	octave --path "/usr/local/myoctavefiles"

Other command line options are detailed at the link below.

	http://www.gnu.org/software/octave/doc/interpreter/Command-Line-Options.html#Command-Line-Options

Ben



More information about the Help-octave mailing list