Low-level untyped system operations
Exception raised when a computation in the current process fails.
with_tmp_dir fn
executes fn
in a tempory directory
copy src dst
copies src
to dst
. Remove dst
before the copy
if it is a link.
install ?exec src dst
copies file src
as file dst
using install
.
If exec
, make the resulting file executable (otherwise, look at the
permissions of the original file to decide).
Checks if a file is an executable (regular file with execution permission)
link src dst
links src
to dst
. Remove dst
if it is a file,
not a directory.
real_path p
returns the real path associated to p
: ..
are
expanded and relative paths become absolute.
read filename
returns the contents of filename
write filename contents
write contents
to filename
remove filename
removes filename
. Works whether filename
is
a file or a directory
remove_file filename
removes filename
. Works only for normal
files (or also at least for symlinks)
remove_dir filename
removes filename
. Works only for
directory (not for symlinks or other files).
Change the current working directory
in_dir dir fn
evaluates fn
in the directory dir
files_with_links dir
returns the files in the directory dir
.
Links simulating directory are ignored, others links are returned.
rec_files dir
returns the list of all files in dir
,
recursively.
Links behaving like directory are crossed.
Return the list of files in the current directory.
rec_dirs dir
return the list list of all directories recursively
(going through symbolink links).
Return the list of directories in the current directory.
directories_with_links dir
returns the directories in the directory dir
.
Links pointing to directory are also returned.
a command is a list of words
Test whether a command exists in the environment.
command cmd
executes the command cmd
in the correct OPAM
environment.
commands cmds
executes the commands cmds
in the correct OPAM
environment. It stops whenever one command fails unless keep_going
is set
to true
. In this case, the first error is re-raised at the end.
read_command_output cmd
executes the command cmd
in the
correct OPAM environment and return the lines from stdout if the command
exists normally. If the command does not exist or if the command exited
with a non-empty exit-code, throw an error.
Test whether the file is an archive, by looking as its extension
extract filename dirname
extracts the archive filename
into
dirname
. dirname
should not exists and filename
should
contain only one top-level directory.
extract_in filename dirname
extracts the archive filename
into
dirname
. dirname
should already exists.
Create a directory. Do not fail if the directory already exist.
Acquires a lock on the given file. Retries 5 times max. By default, this is a write lock.
download compiler sources
Apply a patch file in the current directory.
Create a tempory file in ~/.opam/logs/<name>XXX
Print stats
The separator character for the PATH variable