This module contains predicates for invoking services which are typically provided by the operating system. Note that the predicates which take names of files or directories as arguments in this module expect atoms, not path aliases. I.e., generally these predicates will not call absolute_file_name/2 on names of files or directories taken as arguments.
Datime is unified with a term of the form datime(Year,Month,Day,Hour,Minute,Second) which contains the current date and time.
datime_struct(datime(Year,Month,Day,Hour,Min,Sec)) :- int(Year), int(Month), int(Day), int(Hour), int(Min), int(Sec).
Time is as in time/1. WeekDay is the number of days since Sunday, in the range 0 to 6. YearDay is the number of days since January 1, in the range 0 to 365.
If Time is given, the rest of the arguments are unified with the date and time to which the Time argument refers.
Bound Time, WeekDay and YearDay as determined by the input arguments.
Bound Time to current time and the rest of the arguments refer to current time.
Opt is a file copy option.
copy_option(overwrite). copy_option(timestamp). copy_option(symlink). copy_option(append).
Opts is a list of file copy options.
The environment variable Name has Value. Fails if variable Name is not defined.
The environment variable Name is removed.
If Name is an atom, then unifies the environment variable Name with its value. Note that this predicate can be used to enumerate all the environment variables using backtracking.
Split PathList atom into the list of paths Paths. Paths in String are separated by the path list separator character (colons in POSIX-like systems, semicolons in Windows). Empty paths are removed from Paths. Paths is empty if PathList is the empty atom.
Unifies Path with the path to the current Ciao executable (which may be a standalone binary or bytecode executable)
The process file creation mask was OldMask, and it is changed to NewMask.
Gets the process file creation mask without changing it.
Unifies current working directory with OldDir, and then changes the working directory to NewDir. Calling working_directory(Dir,Dir) simply unifies Dir with the current working directory without changing anything else.
Changes current working directory.
Gets current working directory.
Changes working directory to Path.
FileList is the unordered list of entries (files, directories, etc.) in Directory.
Returns a unique Filename based on Template: Template must be a valid file name with six trailing X, which are substituted to create a new file name. Filename is created in read/write mode but closed immediately after creation.
Succeeds if File (a file or directory) exists (and is accessible).
File (a file or directory) exists and it is accessible with Mode, as in the Unix call access(2). Typically, Mode is 4 for read permission, 2 for write permission and 1 for execute permission.
File has the property Property. The possible properties are:
If Property is uninstantiated, the predicate will enumerate the properties on backtracking.
The file Path has the following properties:
The file File was last modified at Time, which is in seconds since January, 1, 1970. Fails if File does not exist.
If File exists, Time is its latest modification time, as in modif_time/2. Otherwise, if File does not exist, Time is zero.
Change the modification time of File to the current time of day. If the file does not exist, it is created with default permissions.
Note: This operation cannot be fully implemented with modif_time/2. In POSIX systems, that can be done as long as the user has write permissions on the file, even if the owner is different. Change of modification time to arbitrary time values is not allowed in this case.
The file File has protection mode Mode.
The file File has protection mode OldMode and it is changed to NewMode.
If OldMode is identical to NewMode then it is equivalent to fmode(File,OldMode)
Delete the directory Directory.
Delete the file File.
Equivalent to make_directory(D,0o777).
TmpDir is the (normalized) temporary directory for scratch space. On POSIX systems it is computed from normalizing the path specified in the TMPDIR environment variable. On Windows it is determined by the TMP or TEMP environment variable. If none is defined, this predicate tries to guess it from some usual locations (/tmp, /var/tmp, /usr/tmp on POSIX, c:\temp, c:\tmp, \temp, \tmp on Windows) or use . as last resort.
File path for the null device (/dev/null file in POSIX, nul in Windows)
Make this thread sleep for some Seconds.
wait/2 waits for the process numbered Pid. Fails if the process does not terminate normally or in case of error (see C waitpid() for details). RetCode is the process return code.
kill/2 sends the signal Signal to the process or process group specified by Pid. See Unix man page for a detailed description of signals.
Executes the OS-specific system shell. When the shell process terminates, control is returned to Prolog. See shell/2 for details.
Executes Command using the OS-specific system shell and stores the exit code in RetCode.
On POSIX-like systems the system shell is specified by the SHELL environment variable ($SHELL -c "command" for passing user commands). On Windows (native builds, MinGW) it is specified by the COMSPEC environment variable (%COMSPEC% /s /c "command" for passing user commands).
Synonym for shell/2.
Duplicate the file descriptor FD into NewFD
Duplicate a file description into a new free file descriptor (C dup())
Duplicate a file description into a specified file descriptor (C dup2())
Close the file descriptor (using C close())
Option specifies if you want to get a relative or a full path. Posix represent a path as usual in unix, and WinPath is the Windows-Style representation of Posix.
Converts a posix path to a Windows-style path. If SwapSlash is swap, slashes are converted in to backslash. If it is noswap, they are preserved.
Using the Windows native API (not POSIX)
H is the home directory (HOME environment variable in POSIX systems and APPDATA in Windows)
Path is the absolute path of the command Name, reachable from the PATH (environment variable) directories if Name is not an absolute path. The suffix for executable files is optionally added to Path depending on the current operating system.