# HG changeset patch -- Bitbucket.org # Project stable # URL http://bitbucket.org/tortoisehg/stable/overview/ # User Henrik Stuart # Date 1246472971 -7200 # Node ID 73aee702785aefcfb6c469923413c3bd9269ab06 # Parent 63738fddd906669374aa0af1286c1717fcf3afdd 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. --- a/contrib/win32/config.py +++ b/contrib/win32/config.py @@ -12,6 +12,7 @@ of the GNU General Public License, incor # current executable to find our package data. import os +import sys import win32api, win32process proc = win32api.GetCurrentProcess() @@ -25,3 +26,10 @@ bin_path = os.path.dirname(procpath) 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)