diff options
author | Mark Hammond <mhammond@skippinet.com.au> | 2001-05-13 08:04:26 +0000 |
---|---|---|
committer | Mark Hammond <mhammond@skippinet.com.au> | 2001-05-13 08:04:26 +0000 |
commit | 62673723a7f042af5be1ef34f4bbdb65b917c686 (patch) | |
tree | 6db30d6e192d576efaa5dc4db989d12cf3a55833 /Lib/ntpath.py | |
parent | 07539686f3f215062077fbfc45dfd0711da3bb86 (diff) | |
download | cpython-62673723a7f042af5be1ef34f4bbdb65b917c686.tar.gz |
Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465.
Diffstat (limited to 'Lib/ntpath.py')
-rw-r--r-- | Lib/ntpath.py | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/Lib/ntpath.py b/Lib/ntpath.py index 63860ce714..47c1acfd54 100644 --- a/Lib/ntpath.py +++ b/Lib/ntpath.py @@ -404,21 +404,12 @@ def normpath(path): # Return an absolute path. def abspath(path): """Return the absolute version of a path""" - try: - import win32api - except ImportError: - global abspath - def _abspath(path): - if not isabs(path): - path = join(os.getcwd(), path) - return normpath(path) - abspath = _abspath - return _abspath(path) if path: # Empty path must return current working directory. + from nt import _getfullpathname try: - path = win32api.GetFullPathName(path) - except win32api.error: - pass # Bad path - return unchanged. + path = _getfullpathname(path) + except WindowsError: + pass # Bad path - return unchanged. else: path = os.getcwd() return normpath(path) |