User Tools

Site Tools


jvs:cigal:manual:chapter3:getfile

CIGAL Reference Manual, Chapter 3 (Functions): getfile

Getfile -- Get a filename from directory lists interactively

usage: fullname = getfile(flag)
or: fullname = getfile(filename,flag)

GETFILE finds the full pathname for a disk file or directory. It does so interactively if the first argument is a 0 or 1 (or omitted) by using the computer's standard filename finding menu utilities that allow you to move through the directory tree to locate the name of a disk file. Alternatively, if the first argument is a filename and the second argument is a directory list such as the PATH string (see PATH(4)) GETFILE checks the directories in the list to find out which, if any, contain the named file. If successful, GETFILE returns the full pathname of the found file.

GETFILE can also be used to return a directory name, if FLAG is 2. The manner the file finding browser is currently implemented does not return directory names. Thus finding a directory name means you select any file within the desired directory. GETFILE then returns the full pathname of that file's directory.

If no FILENAME argument is specified (i.e., the first argument is a number) the meaning of that FLAG argument is:

          FLAG: 0 - get pathname of existing file (default)
                1 - get pathname of new file
                2 - get pathname of existing directory
                          (Note: click on any file within the directory)
                4 - use CURDIR as starting directory
                8 - return whole path; otherwise rel. CURDIR
                          (assumed if Flags 1 or 2 set)
                16 - don't convert '\' to '/'
                32 - don't include final '/' in directory name (with 2)

If a FILENAME character string is specified as the first argument, GETFILE will return a path for that file. The format of the returned path string is controlled by the FLAG argument as follows:

          FLAG: 0 - return pathname with /'s instead of \'s
                1 - return pathname with the system's native directory character
                   (e.g.'\' on DOS or Windows, on Unix or Linux, and ':' on Macintosh)
                2 - like 1, but use '\\' instead of '\'
                3 - return filename only (omit directory path)
                4 - return directory path only (omit filename)
                5 - like 4, but include directory character at end

See Also:
PATH(4)

CIGAL Home, CIGAL Manual, Functions List, Manual Help

jvs/cigal/manual/chapter3/getfile.txt · Last modified: 2023/02/23 18:43 (external edit)