[Pythonmac-SIG] os.path.normpath()

Jack Jansen jack@oratrix.nl
Thu, 03 Aug 2000 15:53:12 +0200


> At 11:43 PM -0700 8/1/2000, Corran Webster wrote:
> >Hi,
> >     there is currently discussion on the distutils list because of some
> >problems with the current implementation of os.path.normpath() on the
> >macintosh.  The problem arises because
> >
> >os.path.normpath("Macintosh HD:Applications:") == "Macintosh HD:Applications:"
> >
> >and
> >
> >os.path.normpath("Macintosh HD:Applications") == "Macintosh HD:Applications"
> >
> >despite the fact that the paths are equivalent.  distutils needs a platform
> >independent way to check for two paths being equivalent, and this is
> >failing because of examples like the above.
> 
> Umm, they're not equivilant.  The former refers to a folder and the 
> latter a file (or application or whatever but not a folder).

Not completely correct: the latter can refer to anything (including a folder). 
It is customary on MacOS to show folder pathnames with the : at the end, but 
this is not absolutely needed (try macfs.FSSpec on the pathname both with and 
without colon and you'll see they return the same).

There is one case where the colon *is* needed, though: if you're referring to 
a toplevel disk. "Macintosh HD:" is the toplevel folder on a disk, "Macintosh 
HD" is a file in the working directory.
--
Jack Jansen             | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@oratrix.com | ++++ if you agree copy these lines to your sig ++++
www.oratrix.nl/~jack    | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm