Add abspath()
This commit is contained in:
parent
1804dc3c07
commit
e294cf620a
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue