NAME

files – a module for Tensile (see
sl(1))

OVERVIEW

files is a Tensile module which provide interface to file system handling functions

Since most of the builtins are directly bound to corr. system functions/calls, they may or may not present in a certain configuration, so one should generally check their presence with feature before using.

The following builtins, however, are guaranteed to exist: rmfile, mvfile, tmpfile, searchpath, ioerror, clearerr. However, the way how these builtins work is highly system-dependent.

For most part, the builtins in the module do not throw errors; instead, they put error condition descriptions in an internal buffer accessible via ioerror.

BUILTINS

exists(filename)

RETURNS:true if filename exists

cd(newdir)

changes the working directory to newdir

mkdir(pathname)

creates a directory pathname

rmdir(pathname)

removes a directory pathname
NOTE:On most systems pathname must be empty

rmfile(pathname) or unlink(pathname)

removes a file pathname
NOTE:One generally cannot remove a directory with this function, use rmdir instead

mvfile(oldname newname)

renames or moves oldname to newname

symlink(source dest)

makes a symbolic link dest to source

link(source dest)

makes a hard link dest to source

tmpfile([prefix])

RETURNS:a unique name suitable for a temporary file with prefix
NOTE:no slashes is added to prefix
ERROR:tmpfile failed: description

filesize(pathname)

RETURNS:the size in bytes of pathname

isnewer(pathname1 pathname2)

RETURNS:true if pathname1 is newer than pathname2

glob(pattern [options])

returns a list containing filenames matching pattern options may be a combination of the following:
NOTE:This builtin's behaviour (inc. the valid patterns) completely depends on the system glob implementation

ioerror()

RETURNS:a I/O error description produced by other functions of the module

clearerr()

clears the error description to be returned by ioerror

searchpath(file pathlist defext [force])

if file has no extenstion, append defext to it

if it does not start with '/', './' or '../', search it in the colon-separated pathlist

if file is not found and force is present and not empty, places file at the last path in pathlist

RETURNS:constructed filename

AUTHOR

Artem V. Andreev

COPYRIGHT

see
sl(1)

SEE ALSO

sl(1)