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.
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.
datime_struct(datime(Year,Month,Day,Hour,Min,Sec)) :- int(Year), int(Month), int(Day), int(Hour), int(Min), int(Sec).
The environment variable Name has Value. Fails if variable Name is not defined.
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.
The environment variable Name is removed.
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.
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)
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.
Equivalent to make_directory(D,0o777).
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 file File.
Delete the directory Directory.
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.
Using the Windows native API (not POSIX)
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.
Replaces all the occurrences of SearchChar by ReplaceChar and unifies the result with Output
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.