[erlang-questions] windows paths in filename module

Antoine Koener <>
Fri Nov 25 14:56:58 CET 2011


If this really bugs you, note that windows doesn't really care about / or \\

cd C:/Program Files/Putty gets you in the putty directory...

Shell completion (cmd.exe) may not work but, Win32 CreateFile works
flawlessly...

Then I would suggest that you don't have to bother with "nativename" anymore

On Fri, Nov 25, 2011 at 2:38 PM, Tim Watson <>wrote:

> What the heck is this all about???
>
> 40>
> os:getenv("HOMEDRIVE").
>
> "C:"
> 41>
> os:getenv("HOMEPATH").
>
> "\\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"
> 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?
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20111125/1fff7887/attachment.html>


More information about the erlang-questions mailing list