diff options
Diffstat (limited to 'appdirs.py')
-rw-r--r-- | appdirs.py | 41 |
1 files changed, 5 insertions, 36 deletions
@@ -484,33 +484,6 @@ def _get_win_folder_from_registry(csidl_name): return dir -def _get_win_folder_with_pywin32(csidl_name): - from win32com.shell import shellcon, shell - dir = shell.SHGetFolderPath(0, getattr(shellcon, csidl_name), 0, 0) - # Try to make this a unicode path because SHGetFolderPath does - # not return unicode strings when there is unicode data in the - # path. - try: - dir = unicode(dir) - - # Downgrade to short path name if have highbit chars. See - # <http://bugs.activestate.com/show_bug.cgi?id=85099>. - has_high_char = False - for c in dir: - if ord(c) > 255: - has_high_char = True - break - if has_high_char: - try: - import win32api - dir = win32api.GetShortPathName(dir) - except ImportError: - pass - except UnicodeError: - pass - return dir - - def _get_win_folder_with_ctypes(csidl_name): import ctypes @@ -565,18 +538,14 @@ def _get_win_folder_with_jna(csidl_name): if system == "win32": try: - import win32com.shell - _get_win_folder = _get_win_folder_with_pywin32 + from ctypes import windll + _get_win_folder = _get_win_folder_with_ctypes except ImportError: try: - from ctypes import windll - _get_win_folder = _get_win_folder_with_ctypes + import com.sun.jna + _get_win_folder = _get_win_folder_with_jna except ImportError: - try: - import com.sun.jna - _get_win_folder = _get_win_folder_with_jna - except ImportError: - _get_win_folder = _get_win_folder_from_registry + _get_win_folder = _get_win_folder_from_registry #---- self test code |