Commits

Henrik Stuart committed 73aee70

contrib/win32: encode unicode paths for use with environment variables

os.environ expects str instances and will try to convert the unicode
strings to native strings, causing paths with non-ascii characters to
crash any hgtk operation.

Comments (0)

Files changed (1)

contrib/win32/config.py

 # current executable to find our package data.
 
 import os
+import sys
 import win32api, win32process
 
 proc = win32api.GetCurrentProcess()
 license_path = os.path.join(bin_path, 'COPYING.txt')
 locale_path = os.path.join(bin_path, 'locale')
 icon_path = os.path.join(bin_path, 'icons')
+
+enc = sys.getfilesystemencoding()
+if enc:
+    bin_path = bin_path.encode(enc)
+    license_path = license_path.encode(enc)
+    locale_path = locale_path.encode(enc)
+    icon_path = icon_path.encode(enc)