[erlang-questions] windows paths in filename module

Tim Watson <>
Fri Nov 25 15:30:22 CET 2011


Problem solved. Thanks Daniel, that's exactly what I'm looking for!!!

On 25 November 2011 14:01, Daniel Goertzen <>wrote:

> If you're just looking for your home dir, try this:
>
>
> 1> init:get_argument(home).
> {ok,[["C:\\Users\\goertzen"]]}
>
>
> Dan.
>
>  On Fri, Nov 25, 2011 at 7:38 AM, 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/8635f1f4/attachment.html>


More information about the erlang-questions mailing list