[erlang-questions] windows paths in filename module

Vlad Dumitrescu <>
Fri Nov 25 14:54:36 CET 2011


Hi!

On Fri, Nov 25, 2011 at 14:38, 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"
> Am I doing something wrong?

I think the trouble is here:

join(Name1, Name2) when is_list(Name1), is_list(Name2) ->
    OsType = major_os_type(),
    case pathtype(Name2) of
	relative -> join1(Name1, Name2, [], OsType);
	_Other -> join1(Name2, [], [], OsType)
    end;

because "\\Users\\602382443" is getting a pathtype of 'volumerelative'
and should be treated just like 'relative' when Name1 is a drive
reference. If it's not, then I'm not sure what is the right
interpretation.

regards,
Vlad



More information about the erlang-questions mailing list