Eric Hodel wrote: > On Oct 1, 2007, at 03:02 , Gareth Adams wrote: >> irb(main):002:0> File.join('/something', 'else').to_s >> => "/something/else" >> >> I notice that adding a slash works as expected, but why is there a >> difference? > > URIs and paths are not the same, "http://example.com/something" and > "http://example.com/something/" are allowed to return different > content. URI.join works off the directory, "/" in your case, rather > than assuming that "/something" is a directory, which may be incorrect. Then again, /something in the filesystem may just as well be a file, rather than a directory, thus if we consider combining a directory name with a file name, File.join('/something', 'else') should logically result /else, while File.join('/something/', 'else') return /something/else. So I guess the behaviour is still inconsistent, unless there's an explicitly different rule for dealing with URLs compared to FS paths... mortee