Commit 2e2ac925 authored by Guido van Rossum's avatar Guido van Rossum

Add abspath()

parent 04332931
......@@ -332,3 +332,10 @@ def normpath(path):
comps.append('.')
return prefix + string.joinfields(comps, os.sep)
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
......@@ -212,3 +212,10 @@ def walk(top, func, arg):
name = join(top, name)
if isdir(name):
walk(name, func, arg)
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
......@@ -365,3 +365,10 @@ def normpath(path):
if not prefix and not comps:
comps.append('.')
return prefix + string.joinfields(comps, os.sep)
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
......@@ -367,3 +367,10 @@ def normpath(path):
if not comps and not slashes:
comps.append('.')
return slashes + string.joinfields(comps, '/')
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment