Search                        Top                                  Index
HELP CURRENT_DIRECTORY                  John Gibson and A.Sloman Nov 1986

    current_directory -> STRING;

returns the current directory as a string.

    STRING -> current_directory;

makes the  directory specified  by STRING the  current directory.
"current_directory" is an "active" variable. (See REF * IDENT).

CONTENTS - (Use <ENTER> g to access sections)

 -- The Current Working Directory
 -- Accessing or changing CURRENT_DIRECTORY
 -- Moving up the directory hierarchy
 -- Changing the directory locally in a procedure
 -- Using PWD or VED_PWD
 -- NOTE on SYSDIRECTORY
 -- RELATED DOCUMENTATION

-- The Current Working Directory --------------------------------------
File names may either be full path names or relative names. In Unix
systems a full path name starts with "/" , "~" (the user's login
directory), or an environment variable defined as a path name, such as
'$usepop'.

In VMS a full path name will include a directory specification in square
brackets. VMS POPLOG automatically translates unix path names to VMS
path names.

There is always a current working directory and if file names are not
specified as full path names they are taken to be relative to the
current directory. E.g. 'init.p' is a name that will refer to a file in
the CURRENT directory whose full path name (in UNIX format) might be
something like '/usr/comp/joe/init.p' or (in VMS) 'DISK$3B:[JOE]INIT.P'

Commands to compile, edit, open, or create a file will refer to a file
in the current directory unless the file name specifies a FULL path
name.

-- Accessing or changing CURRENT_DIRECTORY ----------------------------
The POP-11 active variable * CURRENT_DIRECTORY has as its value a string
holding the full path name of the current directory. This string can be
updated by assigning a new string to it, in the form of an absolute or
relative file name.

E.g.
To make subdirectory baz of subdirectory foo of the current directory
the new current directory, do:

    'foo/baz' -> current_directory;

This is equivalent to:

    current_directory dir_>< 'foo/baz' -> current_directory

(Since 'dir_><' concatenates strings to form valid file names.)

On VMS do, instead:

    '[.foo.baz]' -> current_directory;

(However, VMS POPLOG can interpret Unix file names.)

-- Moving up the directory hierarchy ----------------------------------
To change to the directory above the current directory do
UNIX
    '..' -> current_directory

VMS
    '[-]' -> current_directory

To move up two levels in the directory tree:
UNIX
    '../..' -> current_directory

VMS
    '[--]' -> current_directory

-- Changing the directory locally in a procedure ----------------------
You can make the current  directory dynamically local to a  procedure
with dlocal, e.g

    define do_action_in(directory);
        lvars directory;
        dlocal current_directory = directory;
        <action>
    enddefine;

does <action> in the given directory and restores the previous current
directory on exit, whether it is a normal or abnormal exit. (See
HELP * DLOCAL).

-- Using PWD or VED_PWD -----------------------------------------------
A POP-11 macro and VED procedure VED_PWD are provided for printing out
the valuw of the current working directory. In POP-11, just type
    pwd
    ** /cog/aarons

in VED do
    <ENTER> pwd

The current directory name will appear on the VED command line.

-- NOTE on SYSDIRECTORY -----------------------------------------------
Prior to Version 12.3 the procedure SYSDIRECTORY was used to access or
update the current directory.  For convenience, it remains as an
autoloadable library procedure, defined in terms of CURRENT_DIRECTORY.

-- RELATED DOCUMENTATION ----------------------------------------------
HELP *CD         - for a convenient way to access current_directory
HELP *PURGE      - a file-purging facility in VED
HELP *DIFF       - for comparing two files
HELP *DIR        - for listing the current directory within VED
REF *SYSIO, *SYSUTIL
                 - more information of input/output and access to
                   operating system.

--- C.all/help/current_directory ---------------------------------------
--- Copyright University of Sussex 1987. All rights reserved. ----------