[erlang-bugs] filename:join breaks Windows UNC paths

Anders.Ramsell <>
Fri Aug 12 14:45:15 CEST 2011


> -----Original Message-----
> Sorry to resurrect an old post, but this just bit me and cost 
> me a day or
> two. Evgeny's patch works and applies to R14B01 and R14B03, 
> though the line
> numbers are now a bit off. I've edited the patch below. 
> 
> Not sure what the proper convention is, but I'd like to vote 
> for this being included in a future release if possible.
> The current assumption that all paths on win32 start with
> a drive letter is no longer valid, especially if
> extended-path name notation is being used 
> (\\?\very\long\path). This is an increasingly common need.

I'd like to add a vote for having this problem fixed since we 
have also been bit by this.

It also appears that some "pathfunctions" like file:get_cwd/0 
already support the "dubble-slash" syntax. The following shell
interaction shows the problem we've had:

1> {ok, Path} = file:get_cwd().
{ok, "//host/share"}
2> filename:join(Path, "file.txt").
"/host/share/file.txt"

Notice that the dubble-slash returned by file:get_cwd/0 gets lost
in the call to filename:join/2.

/Anders Ramsell




More information about the erlang-bugs mailing list