module Sys:sig
..end
val argv : string array
val executable_name : string
?follow_symlinks
defaults to true
.val file_exists : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
file_exists ~follow_symlinks path
Test whether the file in path
exists on the file system.
If follow_symlinks
is true
and path
is a symlink the result concerns
the target of the symlink.
`Unknown
is returned for files for which we cannot successfully determine
whether they are on the system or not (e.g. files in directories to which we
do not have read permission).
val file_exists_exn : ?follow_symlinks:bool -> string -> bool
file_exists
but blows up on `Unknown
val is_directory : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
`Yes
if the file exists and is a directoryval is_file : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
`Yes
if the file exists and is a regular fileval is_directory_exn : ?follow_symlinks:bool -> string -> bool
val is_file_exn : ?follow_symlinks:bool -> string -> bool
val remove : string -> unit
val rename : string -> string -> unit
rename
may
replace it, or raise an exception, depending on your operating system.val getenv : string -> string option
None
if the variable is unbound.val getenv_exn : string -> string
val command : string -> int
command_exn command
runs command
and then raises an exception if it
returns with nonzero exit status.
val command_exn : string -> unit
val chdir : string -> unit
val getcwd : unit -> string
val readdir : string -> string array
"."
and ".."
in
Unix) are not returned. Each string in the result is a file name rather
than a complete path. There is no guarantee that the name strings in the
resulting array will appear in any specific order; they are not, in
particular, guaranteed to appear in alphabetical order.val fold_dir : init:'acc -> f:('acc -> string -> 'acc) -> string -> 'acc
val ls_dir : string -> string list
val interactive : bool Pervasives.ref
false
in standalone programs and to
true
if the code is being executed under the interactive toplevel system
ocaml
.val os_type : string
"Unix"
(for all Unix versions, including Linux and Mac OS X),"Win32"
(for MS-Windows, OCaml compiled with MSVC++ or Mingw),"Cygwin"
(for MS-Windows, OCaml compiled with Cygwin).val word_size : int
exception Break
Sys.catch_break
is on.val catch_break : bool -> unit
Warning: catch_break uses deep ocaml runtime magic to raise Sys.Break inside of the main execution context. Consider explicitly handling Signal.int instead. If all you want to do is terminate on CTRL-C you don't have to do any special setup, that's the default behavior.
catch_break
governs whether interactive interrupt (ctrl-C) terminates the
program or raises the Break
exception. Call catch_break true
to enable
raising Break
, and catch_break false
to let the system terminate the
program on user interrupt.
val ocaml_version : string
ocaml_version
is the version of Objective Caml. It is a string of the form
"major.minor[.patchlevel][+additional-info]"
, where major
, minor
, and
patchlevel
are integers, and additional-info
is an arbitrary string. The
[.patchlevel]
and [+additional-info]
parts may be absent.val execution_mode : unit -> [ `Bytecode | `Native ]
execution_mode
tests whether the code being executed was compiled natively
or to bytecode.val c_int_size : unit -> int
c_int_size
returns the number of bits in a C int
. Note that this can be
different from word_size
. For example, Linux x86-64 should have
word_size = 64
, but c_int_size () = 32