summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-29 22:30:41 (GMT)
committerGuido van Rossum <guido@python.org>1999-01-29 22:30:41 (GMT)
commit9787bea4cd58b31896e643fc16b7430af5b099e8 (patch)
tree9d067489f109fcab1a67a6c6da0386191fe02c09 /Lib
parent28e66d1c5ed696e5aa7fcd82d6787e9a8f8b7727 (diff)
downloadcpython-9787bea4cd58b31896e643fc16b7430af5b099e8.zip
cpython-9787bea4cd58b31896e643fc16b7430af5b099e8.tar.gz
cpython-9787bea4cd58b31896e643fc16b7430af5b099e8.tar.bz2
Use win32api.GetFullPathName(path) if it exists to implement abspath().
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ntpath.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index 6bab89d..5782cbe 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -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)