mirror of https://github.com/python/cpython
Add abspath()
This commit is contained in:
parent
1804dc3c07
commit
e294cf620a
|
@ -332,3 +332,10 @@ def normpath(path):
|
||||||
comps.append('.')
|
comps.append('.')
|
||||||
return prefix + string.joinfields(comps, os.sep)
|
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)
|
name = join(top, name)
|
||||||
if isdir(name):
|
if isdir(name):
|
||||||
walk(name, func, arg)
|
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:
|
if not prefix and not comps:
|
||||||
comps.append('.')
|
comps.append('.')
|
||||||
return prefix + string.joinfields(comps, os.sep)
|
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:
|
if not comps and not slashes:
|
||||||
comps.append('.')
|
comps.append('.')
|
||||||
return slashes + string.joinfields(comps, '/')
|
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