##// END OF EJS Templates
win32: new function executable_path
Adrian Buehlmann -
r13376:60b5c6c3 default
parent child Browse files
Show More
@@ -211,9 +211,8 b' def lookup_reg(key, valname=None, scope='
211 finally:
211 finally:
212 adv.RegCloseKey(kh.value)
212 adv.RegCloseKey(kh.value)
213
213
214 def system_rcpath_win32():
214 def executable_path():
215 '''return default os-specific hgrc search path'''
215 '''return full path of hg.exe'''
216 rcpath = []
217 size = 600
216 size = 600
218 buf = ctypes.create_string_buffer(size + 1)
217 buf = ctypes.create_string_buffer(size + 1)
219 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
218 len = _kernel32.GetModuleFileNameA(None, ctypes.byref(buf), size)
@@ -221,7 +220,12 b' def system_rcpath_win32():'
221 raise ctypes.WinError()
220 raise ctypes.WinError()
222 elif len == size:
221 elif len == size:
223 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
222 raise ctypes.WinError(_ERROR_INSUFFICIENT_BUFFER)
224 filename = buf.value
223 return buf.value
224
225 def system_rcpath_win32():
226 '''return default os-specific hgrc search path'''
227 rcpath = []
228 filename = executable_path()
225 # Use mercurial.ini found in directory with hg.exe
229 # Use mercurial.ini found in directory with hg.exe
226 progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
230 progrc = os.path.join(os.path.dirname(filename), 'mercurial.ini')
227 if os.path.isfile(progrc):
231 if os.path.isfile(progrc):
General Comments 0
You need to be logged in to leave comments. Login now