Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

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.

Changeset 73aee702785a

Parent 63738fddd906

by Henrik Stuart

Changes to one file · Browse files at 73aee702785a Showing diff from parent 63738fddd906 Diff from another changeset...

 
12
13
14
 
15
16
17
 
25
26
27
 
 
 
 
 
 
 
 
12
13
14
15
16
17
18
 
26
27
28
29
30
31
32
33
34
35
@@ -12,6 +12,7 @@
 # current executable to find our package data.    import os +import sys  import win32api, win32process    proc = win32api.GetCurrentProcess() @@ -25,3 +26,10 @@
 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)