From: "Berger, Daniel" Date: 2005-09-14T04:19:28+09:00 Subject: Re: File.split edge cases > -----Original Message----- > From: Austin Ziegler [mailto:halostatue@gmail.com] > Sent: Tuesday, September 13, 2005 12:56 PM > To: ruby-core@ruby-lang.org > Subject: Re: File.split edge cases > > # pseudo-code > > if path.root? or path.empty? > > return path, "" > > else > > return File.dirname(path), File.basename(path) > > end > > Hmmm. I don't think that's right, still. "ls //" is valid on > Unix, so the existing behaviour is *correct*, if mildly > unnerving. I don't know that just because "ls" handles it one can conclude that it's correct behavior on Unix. But, again, without a POSIX document sitting in front of me, I'm just not sure. My Google skills are failing me. > However, on Windows, "dir \\" is not correct just > as "dir C:\\" will not be correct. Better to specifically > check for the UNC-path and drive-path cases. Ruby should also > be smart enough to handle the \\.\ and \\?\ special prefixes. > I can write up a summary of what these are for and how they > should be handled, if that would help. I think that would be good, along with a series of test cases that could be incorporated as part of the Ruby distro. I already have quite a few for File.basename and File.dirname (as part of win32-file), though I have to admit I didn't test with "\\.\" or "\\?\", though I do have generic UNC path tests. Regards, Dan