Sat 27 Dec 2008
Not that I spend much time compiling erlang code in Windows (unless I’m using cygwin or coLinux), but the issue does pop up from time to time. Here are a few minor tricks that can help a bit.
Starting Erlang in the current directory
For a unix user, it’s of course odd that this should be a problem.
John Hughes used a nice trick that’s so simple that I slap myself for not having thought of it: Right-click on a .beam file, select “Open With…” and locate werl.exe. Now you can open an erlang shell in the current working directory by double-clicking a .beam file.
Modifying the Windows context menu
So what if you don’t have any .beam files, and you’re trying to get to an erlang shell
in order to create some?
I did some googling and found this tutorial on youtube on how to add custom entries to the context menu.
It seemed simple enough, but Vista still served me a few hours of utter confusion since it took what I inserted, and then copied it to another place in the registry (without letting me know)… but only the first time. My changes and additions were simply ignored. The solution? Search the registry for the key you inserted, and you’ll figure out where Vista wants it to be, then make your changes there.
What I’ve experimented with so far is to add under Computer\HKEY_CLASSES_ROOT\ErlangSource\shell\ the following entries:
Compile with erlc
- Command = "C:\Program Files\erl5.6.3\bin\erlc.exe" "%1"
- Command = "C:\Program Files\erl5.6.3\bin\werl.exe" "-make"
- Command = "C:\Program Files\erl5.6.3\bin\werl.exe" "%1"
A problem with running erlc this way is that the window is destroyed immediately upon completion. I’ve poked around a bit for good workarounds. One option is of course to write an erlang function that compiles the file, then either sleeps a short while, or waits for input.