Search code examples
ocamlocaml-toplevel

OCaml toplevel print current directory?


Within OCaml toplevel I am trying to print the current directory.

i.e.

# Filename.current_dir_name;;

which returns

- : string = "."

which is not very useful.

What is the toplevel command needed to display the full path of the current directory?


Solution

  • Many system calls can be done via sys

    In your case, Sys.getcwd();;