Ocaml module Sys
Highlight problem
utop # Sys.executable_name;;
- : string = "/Users/hwu/.opam/4.01.0/bin/utop"
utop # Sys.argv;;
- : string array = [|"/Users/hwu/.opam/4.01.0/bin/utop"|]
utop # Sys.getenv "PWD";;
- : string option = Some "/Users/hwu"
utop # Sys.getcwd ();;
- : string = "/Users/hwu/test"
utop # Sys.getcwd () |> Sys.readdir ;;
- : string array = [|"a.txt"; "b.txt"; "c.txt"|]
Use Sys to get information about the system
utop # Sys.os_type;;
- : string = "Unix"
utop # Sys.word_size;;
- : int = 64
utop # Sys.ocaml_version;;
- : string = "4.01.0+rc1"
get the module definition
utop # module M = Sys;;
module M :
sig
val argv : string array
val executable_name : string
val file_exists : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
val file_exists_exn : ?follow_symlinks:bool -> string -> bool
val is_directory : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
val is_file : ?follow_symlinks:bool -> string -> [ `No | `Unknown | `Yes ]
val 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
val getenv : string -> string option
val getenv_exn : string -> string
val command : string -> int
val command_exn : string -> unit
val chdir : string -> unit
val getcwd : unit -> string
val readdir : string -> string array
val fold_dir : init:'acc -> f:('acc -> string -> 'acc) -> string -> 'acc
val ls_dir : string -> string list
val interactive : bool ref
val os_type : string
val word_size : int
exception Break
val catch_break : bool -> unit
val ocaml_version : string
val execution_mode : unit -> [ `Bytecode | `Native ]
external c_int_size : unit -> int = "c_int_size" "noalloc"
end