| Author |
Message |
< Erlang ~ changing directory doesn't work |
| buraque |
Posted: Sun Aug 10, 2008 9:09 pm |
|
|
|
Joined: 10 Aug 2008
Posts: 3
|
Hello. I just started to learn erlang. I bought the book and Joe is saying sth. like this:
"Tip for Windows users: Create a file called C:/Program
Files/erl5.4.12/bin/.erlang (you might have to change this if your
installation details vary).
Add the following to the file:
io:format("consulting .erlang in ~p~n" ,
[element(2,file:get_cwd())]).
%% Edit to the directory where you store your code
c:cd("c:/work" ).
io:format("Now in:~p~n" , [element(2,file:get_cwd())]).
Now when you start Erlang, it will automatically change directory
to C:/work. "
I did it and instead of C:/work, created a folder in user/documents. Anyway, when i restart the shell and enter pwd() i see that my working directory hasnt changed:
Erlang (BEAM) emulator version 5.6.3 [smp:4] [async-threads:0]
Eshell V5.6.3 (abort with ^G)
1> pwd().
C:/Program Files/erl5.6.3/usr
ok
Is the file .erlang the extension or the name of the file or the name of a folder?
Also note that when I use cd() it doesnt change the directory either:
2> cd("C:\Users\user\Documents\erlang_projects").
C:/Program Files/erl5.6.3/usr
ok
btw i am using Win Vista Home Premium 32bit |
|
|
| Back to top |
|
| buraque |
Posted: Sun Aug 10, 2008 9:14 pm |
|
|
|
Joined: 10 Aug 2008
Posts: 3
|
dont mind the second cd() question. when i changed the direction of slashes, it worked. This is funny, because i havent manually typed the directory, i have copied it from the Windows Explorer.
anyway, cd() only works for the current shell session. I still couldnt make .erlang file work |
|
|
| Back to top |
|
| Mazen |
Posted: Mon Aug 11, 2008 10:17 am |
|
|
|
User
Joined: 20 Jul 2006
Posts: 164
Location: London
|
Best way imho is to create a shortcut link to werl and in the properties of that link enter the directory it should run in. Then just use that link to run the shell when ever you want to work with that project. This is also more flexible because then you can have multiple projects to work with without the hassle of changing the .erlang file each time.
However I would suggest you put these two lines in your .erlang
Code:
dbg:tracer().
dbg:p(all,c).
I find them VERY handy to put there specially when developing.
/Mazen |
|
|
| Back to top |
|
| buraque |
Posted: Mon Aug 11, 2008 8:30 pm |
|
|
|
Joined: 10 Aug 2008
Posts: 3
|
| thanks Mazen, this is really a good idea:) |
|
|
| Back to top |
|
| rvirding |
Posted: Fri Aug 22, 2008 1:57 pm |
|
|
|
User
Joined: 30 Aug 2006
Posts: 452
Location: Stockholm, Sweden
|
[quote="buraque"]dont mind the second cd() question. when i changed the direction of slashes, it worked. This is funny, because i havent manually typed the directory, i have copied it from the Windows Explorer./quote]
This is not at all funny as \ is a quote character in strings so the resultant string will not be quite what you think. Yo have to quote the quotes:
Code: cd("C:\\Users\\user\\Documents\\erlang_projects").
Windows and C don't really match sometimes. |
|
|
| Back to top |
|
| ryanmoritz |
Posted: Wed Mar 28, 2012 2:17 pm |
|
|
|
Joined: 28 Mar 2012
Posts: 4
Location: United States of America
|
| Now I knew the tips for using it. |
|
|
| Back to top |
|
| number |
Posted: Mon Jun 04, 2012 8:26 am |
|
|
|
User
Joined: 04 Jun 2012
Posts: 18
|
|
| Back to top |
|
| dongdongwu |
Posted: Thu Sep 20, 2012 5:45 am |
|
|
|
User
Joined: 19 Sep 2012
Posts: 236
|
His good friend Diane said: "Christian Louboutin Men Shoes was a magician, he make shoes is immediately put his female people with legs and advantage. He understands women wanted to do and can make them into beautiful Cinderella." Madonna often in its concert wearing Christian louboutin high heels , and some famous superstar like Angelina jolie, mariah Carey, beyonce Knowles, the famous Japanese singer YaYouMei Hamasaki helps Christian Louboutin Men Shoes set up its powerful position. The youngest customers will count Tom cruise's daughter sully cruz. Louboutin made for only a pair of handmade Christian Louboutin high heel Shoes! Want to be more fashion? Put on Christian Louboutin Outlet !
Candy colors of the chalaza high-heeled shoes with lolita type allure, set full finely gem blue "neon shoes" is to need to use "sexy" to describe. Each pair are worth careful appreciation of lithe and graceful fairy ludaoli, what kind of most let you move?Christian Louboutin Men Shoes that one brush red is always cannot resist the temptation, Christian Louboutin men outlet continue to use the days of high 8cm above slender heel proclaim the sexy and luxuriant. The bowknot on black pointed high-heeled shoes with sharp rivet concomitant, wild python met enchanting color printing grain, It is that pairs of high-heeled shoes lets Carrie more feminine flavour. Like Christian Louboutin for men her word. |
|
|
| Back to top |
|
|
|