[Python-Dev] Re: os.path.commonprefix breakage (original) (raw)

Tim Peters tim_one@email.msn.com
Thu, 17 Aug 2000 23:58:13 -0400


[Greg Ewing]

... A trailing slash on a Unix pathname doesn't tell you anything about whether it refers to a directory.

It does if it's also the only character in the pathname <0.5 wink>. The same thing bites people on Windows, except even worse, because in UNC pathnames the leading

\machine\volume

"acts like a root", and the presence or absence of a trailing backslash there makes a world of difference too.

... The only sure way to find out whether a given pathname refers to a directory or not is to ask the filesystem.

On Windows again,

from os import path path.exists("/python16") 1 path.exists("/python16/") 0

This insane behavior is displayed by the MS native APIs too, but isn't documented (at least not last time I peed away hours looking for it).

just-more-evidence-that-windows-weenies-shouldn't-get-a-vote!-ly y'rs - tim