next up previous contents index
Next: 6.3 Evaluating Arithmetic Expressions Up: 6.2 Interactions with the Previous: 6.2 Interactions with the   Contents   Index

6.2.1 The path_sysop/2 interface

In addition, XSB provides the following unified interface to the operations on files. All these calls succeed iff the corresponding system call succeeds. These calls work on both Windows and Unixes unless otherwise noted.
path_sysop(isplain, +Path)

Succeeds, if Path is a plain file.
path_sysop(isdir, +Path)

Succeeds, if Path is a directory.
path_sysop(rename, +OldPath, +NewPath)

Renames OldPath into NewPath.
path_sysop(copy, +FromPath, +ToPath)

Copies FromPath into ToPath.
path_sysop(rm, +Path)

Removes the plain file Path.
path_sysop(rmdir, +Path)

Deletes the directory Path, succeeding only if the directory is empty.
path_sysop(rmdir_rec, +Path)

Deletes the directory Path along with any of its contents.
path_sysop(link, +SrsPath, +DestPath)

Creates a hard link from SrsPath to DestPath. UNIX only.
path_sysop(cwd, -Path)

Binds Path to the current working directory.
path_sysop(chdir, +Path)

Changes the current working directory to Path.
path_sysop(mkdir, +Path)

Creates a new directory, Path.
path_sysop(exists, +Path)

Succeeds if the file Path exists.
path_sysop(readable, +Path)

Succeeds if Path is a readable file.
path_sysop(writable, +Path)

Succeeds if Path is a writable file.
path_sysop(executable, +Path)

Succeeds if Path is an executable file.
path_sysop(modtime, +Path, -Time)

Returns a list that represents the last modification time of the file. Succeeds if file exists. In this case, Time is bound to a list [high,low] where low is the least significant 24 bits of the modification time and high is the most significant bits (25th) and up. Time represents the last modification time of the file. The actual value is thus $\tt high*2^{24} + low$, which represents the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
path_sysop(newerthan, +Path1, +Path2)

Succeeds is the last modification time of Path1 is higher than that of Path2. Also succeeds if Path1 exists but Path2 does not.
path_sysop(size, +Path, -Size)

Returns a list that represents the byte size of Path. Succeeds if the file exists. In this case Size is bound to the list of the form [high,low] where low is the least significant 24 bits of the byte-size and high is the most significant bits (25th) and up. The actual value is thus $\tt high*2^{24} + low$.
path_sysop(tmpfilename, -Name)

Returns the name of a new temporary file. This is useful when the application needs to open a completely new temporary file.
path_sysop(extension, +Name, -Ext)

Returns file name extension.
path_sysop(basename, +Name, -Base)

Returns the base name of the file name (i.e., the name sans the directory and the extension).
path_sysop(dirname, +Name, -Dir)

Returns the directory portion of the filename. The directory is slash or backslash terminated.
path_sysop(isabsolute, +Name)

Succeeds if Name is an absolute path name. File does not need to exist.
path_sysop(expand, +Name, -ExpandedName)

Binds ExpandedName to the expanded absolute path name of Name. The file does not need to exist. Duplicate slashes, references to the current and parent directories are factored out.


next up previous contents index
Next: 6.3 Evaluating Arithmetic Expressions Up: 6.2 Interactions with the Previous: 6.2 Interactions with the   Contents   Index
Terrance Swift 2007-10-05