octave-maintainers
[Top][All Lists]
Advanced

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

Re: path handling


From: John W. Eaton
Subject: Re: path handling
Date: Fri, 12 May 2006 01:06:43 -0400

On 11-May-2006, Bill Denney wrote:

| On Thu, 11 May 2006, John Swensen wrote:
| 
| > Would you be willing to accept a patch for an additional function that 
| > takes all the directories in the search path and makes a more terse 
| > list?
| > For example a function called terse_path() would return something 
| > like
| > [ '.'
| >  '/home/jswensen/m'
| >  '/home/jswensen/pkg/m//'
| >  '/usr/share/octave-2.9.5+/blah//' ]
| >
| > where the '//' at the end indicates the directories are recursive.  I
| > just know that if I ever have a deep tree of M files, and want to know
| > which path comes first in the search path, it can get *really* ugly.

I don't really see why Octave needs this function.  Just typing path
displays a list that is not too hard to read, and I would expect that
most user additions to the default path will appear at the beginning
of the list, so they should not be too hard to find.

If you want ot know where a particular function comes from, use the
which command.

| It would probably be more useful and drive fewer user questions if it 
| generated commands that would regenerate the path like:
| 
| addpath ('.');
| addpath ('/home/jswensen/m');
| addpath (genpath ('/home/jswensen/pkg/m'));

Yes, that could be useful.  Or you could just generate the final
result with one call to path:

  path (".",
        "~/m",
        genpath ("~/pkg/m"),
        pathdef ())

| addpath (genpath ('/usr/share/octave-2.9.5+/blah');

I don't know why you would need to add any directories like this to
your path.  All the "system" directories should all be added
automatically when Octave starts.  The new pathdef function will list
them for you.  So the first thing you might want your function to do
is

  strrep (path (), pathdef (), ":PATHDEF")

Provided that you have not removed any directories from the "pathdef"
part of the search path, this should leave you with the diretories you
have added.  Replacing the default search path with PATHDEF will show
you where the default path fits in relative to your own extra
directories.

jwe


reply via email to

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