Steve Borho  committed 7bdaa1c

hgtk: use win32api's SetDllDirectory to force gtk/ folder precedence

Moving the GTK DLL's into their own folder was helpful to prevent other
GTK applications from picking up our DLLs, but it actually made it more
likely that hgtk.exe would pick up incorrect DLLs from C:\Windows\system32.

Closes #1678 and other bugs related to GTK DLL load failures

  • Participants
  • Parent commits 5a5be8d
  • Branches stable

Comments (0)

Files changed (1)

 import sys
 if hasattr(sys, "frozen"):
-    # Prepend C:\Program Files\TortoiseHg\gtk (equiv) to the path
     from tortoisehg.util import paths
+    import win32api
     gtkpath = os.path.join(paths.bin_path, 'gtk')
-    os.environ['PATH'] = os.pathsep.join([gtkpath, os.environ['PATH']])
+    win32api.SetDllDirectory(gtkpath)
     # if hgtk is a symlink, insert symlink target directory in sys.path
     thgpath = os.path.dirname(os.path.realpath(__file__))