# HG changeset patch # User Adrian Buehlmann # Date 1297678351 -3600 # Node ID 60b5c6c3fd12b198235bb26f79808f0a8f3c7bd6 # Parent f1fa8f481c7c4af377f22ba33d93db7f9025e43e win32: new function executable_path diff -r f1fa8f481c7c -r 60b5c6c3fd12 mercurial/win32.py --- a/mercurial/win32.py Mon Feb 14 11:12:26 2011 +0100 +++ b/mercurial/win32.py Mon Feb 14 11:12:31 2011 +0100 @@ -211,9 +211,8 @@ 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 @@ 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):