Next: delete() Up: MacAnova Help File Previous: data_files   Contents


Keywords: files, input, output
This topic describes how variable DATAPATHS determines where MacAnova
searches for files when you use a command such as matread(), vecread()
or macroread() to read a file.  For all such commands, the first
argument is a CHARACTER scalar or quoted string specifying a file name.
See topic 'file_names'.

DATAPATHS must be a CHARACTER scalar or vector.  Each element must be
the name (path) of a directory, ending with a separator character ('/'
or '\' in Windows or MSDOS, '/' in Unix/Linux, ':' on Macintosh).  See
topic 'file_names' for information on path names.

When a file name is not a pure file name, that is, it contains any of
the separator characters used with volume, directory or folder names
(':' on a Macintosh, ':', '\' or '/' in Windows or DOS, or '/' in
Unix/Linux) no further search is made when MacAnova is not able to read
the file.

When a file name is a pure file name, that is it contains no special
separator characters, MacAnova first looks for the file in the default
directory or folder (see topic 'files').

When the file is not found in the default directory, MacAnova searches
for it in the directory or folder whose name is in DATAPATHS[1], then in
DATAPATHS[2] and so on.  When the file is not found in any of these, you
are informed that the file could not be opened.

You can use macro adddatapath() to add directories or folders to the
start or end of DATAPATHS.  See adddatapath().

On a Macintosh or DOS/Windows computer, DATAPATHS is pre-defined to the
name of the Macintosh folder or directory (the folder or directory where
the executable file is located).  On Unix/Linux its value is the name of
the installation-dependent directory containing the standard macro
files.  In the distributed Linux binary, the default is

You can change the defaults by setting DATAPATHS in a start up file or
by setting environmental variable MACANOVA (not on Macintosh).  See
topic 'customize'.  Except on a Macintosh, you can also use command line
option '-dpath' to initialize DATAPATHS.  See topic 'launching'

For compatibility with earlier versions of MacAnova, if variable
DATAPATHS does not exist, variable DATAPATH is substituted, if it

Windows and DOS:
  When DATAPATHS is vector("A:/SURVEY/", "C:/MACANOVA"),
  matread("mydata.dat") first tries to read MYDATA.DAT in the default
  directory or folder and then, if not successful, tries to read

  When DATAPATHS is vector("JoesFloppy:Survey:","Macintosh
  HD:MacAnova:"), matread("Mydata.dat") first tries to read Mydata.dat
  in the default folder and then, if not successful, it tries to read
  JoesFloppy:Survey:Mydata.dat and MacAnova HD:MacAnova:Mydata.dat.

  When DATAPATHS is vector("/users/joe/survey/", "/usr/lib/macanova/"),
  matread("mydata.dat") first tries to read mydata.dat in the current
  default directory, and then, if not successful, it tries to read file
  /users/joe/survey/mydata.dat and /usr/lib/macanova/mydata.dat.

Gary Oehlert 2003-01-15