Mercurial > hg
changeset 13376:60b5c6c3fd12
win32: new function executable_path
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Mon, 14 Feb 2011 11:12:31 +0100 |
parents | f1fa8f481c7c |
children | 4ac565a30e84 |
files | mercurial/win32.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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):