tags:

views:

103

answers:

4

Hello, I have Erlang installed on my WinXP machine. Becouse so, I use it by a "werl.exe". The problem is, that I would like to change a default folder that werl starts in. I cannot find option that would let me do that, although I know there must be something like that. Could anybody help ?

+4  A: 

Thank you all. It was just as easy as typing a desired path in the "Start in" option in the "preferences" of shortcut to werl.exe.

Zbigniew
+1  A: 

If you want to run Erlang in many different projects in different directories I found the easiest most basic solution is to create separate .bat files in each directory. Clicking on one will then run Erlang in the right directory. This makes it easy to set environment variables for Erlang, ERL_LIBS is a good one. It also makes it easy to use different versions at the same time, one .bat file for each version.

rvirding
Thank you for this tip.
Zbigniew
A: 
  • You can specify initial settings in a .erlang file

  • It should be located c:\Program Files\erlX.X.X\usr.erlang (where X.X.X is the version number...)

  • If there isn't any then feel free to create one.

  • Here is a simple example for the content:

    io:format("c:\Program Files\erl5.7.5\usr\.erlang\n").
    io:format(" ______      _                   \n").
    io:format("|  ____|    | |                  \n").
    io:format("| |__   _ __| | __ _ _ __   __ _ \n").
    io:format("|  __| | '__| |/ _` | '_ \\ / _` |\n").
    io:format("| |____| |  | | (_| | | | | (_| |\n").
    io:format("|______|_|  |_|\\__,_|_| |_|\\__, |\n").
    io:format("                            __/ |\n").
    io:format("                           |___/ \n\n").
    shell_default:cd("c:/Documents/Erlang/UnderConstruction").
    
  • It can be tested by running an erlang shell and on startup it will print this cool ASCII stuff :)

  • Of course the main important line is shell_default:cd("c:/Documents/Erlang/UnderConstruction"). where you specify which directory you want to start with as current.

Enjoy.

Dlf
Thank you very much, although, you solution is good to change working directory for all projects. I wanted something, that could make easy to change working directory for every project separatly.Although, as I said, it's nice tip so thank you for that :)
Zbigniew
A: 

If you want to change directory at run time in the emulator then use the built in function cd as below..

72> cd("c:/Sandbox/erl").
c:/Sandbox/erl
ok

Note: You need to use the forward slash and not backward slash as you would normally do in windows.

Gnu Engineer