erlangchicagoboss

Get current directory in erlang


I'm using chicagoboss for web development. To test some test modules I would like to change my current directory to something else. I know I can change directory by specifying full path to to cd("full path"). Suppose I'm in a directory "/home/user/workspace/myproject/myapp/" where I'm running myproject project.But now I want to check my current location using erlang shell.

Is there any function/command in erlang to get current working directory? In python I was using os.getcwd().


Solution

  • Try:

    {ok, CurrentDirectory} = file:get_cwd().

    Also check out erldocs.com to quickly look up functions in the Erlang documentation.