[PATCH 3 of 6 V2] win32: new function executable_path
Adrian Buehlmann
adrian at cadifra.com
Mon Feb 14 07:44:31 CST 2011
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1297678351 -3600
# Node ID 60b5c6c3fd12b198235bb26f79808f0a8f3c7bd6
# Parent f1fa8f481c7c4af377f22ba33d93db7f9025e43e
win32: new function executable_path
diff --git a/mercurial/win32.py b/mercurial/win32.py
--- a/mercurial/win32.py
+++ b/mercurial/win32.py
@@ -211,9 +211,8 @@ def lookup_reg(key, valname=None, scope=
finally:
adv.RegCloseKey(kh.value)
-def system_rcpath_win32():
- '''return default os-specific hgrc search path'''
- rcpath = []
+def executable_path():
+ '''return full path of hg.exe'''
size = 600
buf = ctypes.create_string_buffer(size + 1)
len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
@@ -221,7 +220,12 @@ def system_rcpath_win32():
raise ctypes.WinError()
elif len == size:
raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
- filename = buf.value
+ return buf.value
+
+def system_rcpath_win32():
+ '''return default os-specific hgrc search path'''
+ rcpath = []
+ filename = executable_path()
# Use mercurial.ini found in directory with hg.exe
progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
if os.path.isfile(progrc):
More information about the Mercurial-devel
mailing list