Fix winpaths' call to wintypes in py3k

This commit is contained in:
Manuel Cortez 2018-10-08 11:20:45 -05:00
parent 17bc40c920
commit b0e02c831a
2 changed files with 16 additions and 0 deletions

12
src/fixes/fix_winpaths.py Normal file
View File

@ -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

View File

@ -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