Manipulating Octave Search Path

Description

Adds a directory at the beginning of Octave search path.

o_inpath tells if a directory or files are in Octave path.

Usage

o_addpath(DIR1, ..., OPTION = "-begin")

o_inpath(...)

Arguments

DIR1
path specification to add to Octave search path. See section Octave Documentation.
...
other path specifications
OPTION
option that specifies how the path should be added. Possible values are: '-begin', 0, '-end', 1. See section Octave Documentation.

Value

returns invisibly the old value of search path.

Details

The .oct files present in directories from the search path are looked up when an object or function is requested but not loaded in the current session. The files are watched and automatically reloaded in case modification.

Octave Documentation for <em>addpath</em>

 -- Built-in Function: addpath (DIR1, ...)
 -- Built-in Function: addpath (DIR1, ..., OPTION)
     Add DIR1, ... to the current function search path.  If OPTION is
     "-begin" or 0 (the default), prepend the directory name to the
     current path.  If OPTION is "-end" or 1, append the directory name
     to the current path.  Directories added to the path must exist.

     In addition to accepting individual directory arguments, lists of
     directory names separated by 'pathsep' are also accepted.  For
     example:

          addpath ("dir1:/dir2:~/dir3");

     See also: path, rmpath, genpath, pathdef, savepath, pathsep

[Generated from Octave-3.6.4 on 2014-05-21 11:08:10 ]

Examples


## Don't show: 
# roxygen generated flag
options(R_CHECK_RUNNING_EXAMPLES_=TRUE)
## End Don't show

#----------
# o_addpath
#----------
# call an undefined function
try(.CallOctave('fun1'))

# add to the path a directory with a .oct file that contains a definition for 'fun1'
o_addpath(system.file('scripts', package='RcppOctave'))
## Warning: autoload: 'example.m' is not an absolute file name
## autoload: 'example.m' is not an absolute file name
## autoload: 'example.m' is not an absolute file name
## autoload: 'example.m' is not an absolute file name

# re-call the function
#.CallOctave('fun1')

# change the .oct file

#----------
# o_inpath
#----------
o_addpath(tempdir())
o_inpath(tempdir())
## /tmp/Rtmpf8pqLM 
##            TRUE
o_inpath(tempfile())
## /tmp/Rtmpf8pqLM/file344c5055eb4 
##                           FALSE

See also

Other Octave_files: o_source