Filename( dir, name ) O
returns the (system dependent) filename as a string for the file with
name name in the directory object dir. Filename returns the
filename regardless of whether the directory contains a file name or
not.
Filename( list-of-dirs, name ) F
If list-of-dirs is a list (possibly of length 1) of directory objects,
then Filename will search the directories in order, and will return the
filename for the file name in the first directory which contains a file
name or fail if no directory contains a file name.
Examples
In order to locate the system program ``date'' use
DirectoriesSystemPrograms together with the second form of Filename.
gap> path := DirectoriesSystemPrograms();; gap> date := Filename( path, "date" ); "/bin/date"
In order to locate the library file ``files.gd'' use DirectoriesLibrary
together with the second form of Filename.
gap> path := DirectoriesLibrary();; gap> Filename( path, "files.gd" ); "./lib/files.gd"
In order to construct filenames for new files in a temporary directory
use DirectoryTemporary together with the first form of Filename.
gap> tmpdir := DirectoryTemporary();; gap> Filename( [ tmpdir ], "file.new" ); fail gap> Filename( tmpdir, "file.new" ); "/var/tmp/tmp.0.021738.0001/file.new"
[Top] [Previous] [Up] [Next] [Index]
GAP 4 manual