[erlang-questions] windows paths in filename module

Tim Watson <>
Fri Nov 25 14:38:36 CET 2011


What the heck is this all about???

40>
os:getenv("HOMEDRIVE").

"C:"
41>
os:getenv("HOMEPATH").

"\\Users\\602382443 <file://users//602382443>"
42> filename:join(os:getenv("HOMEDRIVE"),
os:getenv("HOMEPATH")).
"/Users/602382443"
43> filename:nativename(filename:join(os:getenv("HOMEDRIVE"),
os:getenv("HOMEPATH"))).
"\\Users\\602382443 <file://users//602382443>"
44> filename:nativename("C:/" ++
os:getenv("HOMEPATH")).
"c:\\Users\\602382443"
45> "C:" ++ os:getenv("HOMEPATH").
"c:\\Users\\602382443"
Do I *really* have to do this by hand? I had assumed that the whole point
of filename:join/2 was that it does the right thing on each platform
without me having to worry about what the directory separator is meant to
be?

Am I doing something wrong?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111125/24cdbf69/attachment.html>


More information about the erlang-questions mailing list