diff --git a/src/fixes/fix_winpaths.py b/src/fixes/fix_winpaths.py new file mode 100644 index 0000000..fc5cbe0 --- /dev/null +++ b/src/fixes/fix_winpaths.py @@ -0,0 +1,12 @@ +# -*- coding: utf-8 -*- +import ctypes +import winpaths +from ctypes import wintypes + +def _get_path_buf(csidl): + path_buf = ctypes.create_unicode_buffer(wintypes.MAX_PATH) + result = winpaths._SHGetFolderPath(0, csidl, 0, 0, path_buf) + return path_buf.value + +def fix(): + winpaths._get_path_buf = _get_path_buf \ No newline at end of file diff --git a/src/main.py b/src/main.py index b14288c..b6299ee 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,9 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals # at top of module +# this is the first fix we have to import just before the paths module would. +# it changes a call from wintypes to ctypes. +from fixes import fix_winpaths +fix_winpaths.fix() import os import logging import storage