ERL_LIBS and Windows (minor quirk)

Steve Davis steven.charles.davis@REDACTED
Tue Jan 5 02:22:57 CET 2010


On Windows, and unlike code:add_path, setting the ERL_LIBS environment 
variable adds paths with a double-backslash... e.g.:

ERL_LIBS=D:\Erlang\lib;...

...results in:

"D:\\Erlang\\lib/yaws/ebin";...

Thus it is possible to add duplicate paths:

1> code:get_path().
[".","D:\\Erlang\\lib/yaws/ebin",...]
2> code:add_patha("D:/Erlang/lib/yaws/ebin").
true
3> code:get_path().
["d:/Erlang/lib/yaws",".","D:\\Erlang\\lib/yaws/ebin",...]

Since code:add_path converts "\\" to "/" you can even do:

2> code:add_patha("D:\\Erlang\\lib/yaws/ebin").
true
3> code:get_path().
["d:/Erlang/lib/yaws",".","D:\\Erlang\\lib/yaws/ebin",...]

...and get the exact same result!

Of course, the real problem here is the design of the underlying OS (in 
many more ways than just this oddity), but perhaps somebody will be 
inspired to tidy this one up as it may have some (if rather tiny) effect 
on the performance of the code server.

/s


More information about the erlang-bugs mailing list