From ef8b654bbea15dc55767a7095e01dff7a3ca86cb Mon Sep 17 00:00:00 2001 From: Mark Hammond Date: Sun, 13 May 2001 08:04:26 +0000 Subject: 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. --- Lib/ntpath.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'Lib/ntpath.py') diff --git a/Lib/ntpath.py b/Lib/ntpath.py index 63860ce7147..47c1acfd544 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) -- cgit v1.2.3