string.replace(...)) instead of a for loop).
Don't call normcase() in normpath() -- the filesystem just might be
case preserving...
# possibly be added as a new function.
def normcase(s):
- res, s = splitdrive(s)
- for c in s:
- if c in '/\\':
- res = res + os.sep
- else:
- res = res + c
- return string.lower(res)
+ return string.lower(string.replace(s, "/", "\\"))
# Return wheter a path is absolute.
# Also, components of the path are silently truncated to 8+3 notation.
def normpath(path):
- path = normcase(path)
+ path = string.replace(path, "/", "\\")
prefix, path = splitdrive(path)
while path[:1] == os.sep:
prefix = prefix + os.sep