[Python-Dev] problems building Python 2.1a1 on QNX 4.25
Fredrik Lundh
fredrik@effbot.org
Fri, 26 Jan 2001 23:25:34 +0100
mal wrote:> > Ooh, very likely:
> > >>> os.path.normpath('//5/foo/bar')
> > '/5/foo/bar'
> >
> > Isn't // at the root a Unix convention of some sort for some
> > network filesystems? Probably normpath() should just leave it alone.
>
> Samba uses //<hostname>/<mountname>/<path>. os.path.normpath()
> should probably leave the leading '//' untouched (having too
> many of those in the path doesn't do any harm, AFAIK).
from 1.5.2's posixpath:
def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
import string
# Treat initial slashes specially
slashes = ''
while path[:1] == '/':
slashes = slashes + '/'
path = path[1:]
...
return slashes + string.joinfields(comps, '/')
from 2.0's posixpath:
def normpath(path):
"""Normalize path, eliminating double slashes, etc."""
if path == '':
return '.'
import string
initial_slash = (path[0] == '/')
...
if initial_slash:
path = '/' + path
return path or '.'
interesting...
Cheers /F