Use win32api.GetFullPathName(path) if it exists to implement abspath().

This commit is contained in:
Guido van Rossum 1999-01-29 22:30:41 +00:00
parent 28e66d1c5e
commit 9787bea4cd

View file

@ -369,6 +369,10 @@ def normpath(path):
# Return an absolute path.
def abspath(path):
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)
try:
import win32api
return win32api.GetFullPathName(path)
except ImportError:
if not isabs(path):
path = join(os.getcwd(), path)
return normpath(path)