##// END OF EJS Templates
win32: read system rcpath from registry...
Steve Borho -
r5583:1b5b81d9 default
parent child Browse files
Show More
@@ -17,7 +17,9 FILES
17 17
18 18 Mercurial reads configuration data from several files, if they exist.
19 19 The names of these files depend on the system on which Mercurial is
20 installed.
20 installed. Windows registry keys contain PATH-like strings, every
21 part must reference a Mercurial.ini file or be a directory where *.rc
22 files will be read.
21 23
22 24 (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc::
23 25 (Unix) <install-root>/etc/mercurial/hgrc::
@@ -29,6 +31,8 installed.
29 31
30 32 (Unix) /etc/mercurial/hgrc.d/*.rc::
31 33 (Unix) /etc/mercurial/hgrc::
34 (Windows) HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial::
35 or::
32 36 (Windows) C:\Mercurial\Mercurial.ini::
33 37 Per-system configuration files, for the system on which Mercurial
34 38 is running. Options in these files apply to all Mercurial
@@ -16,6 +16,7 import win32api
16 16 from i18n import _
17 17 import errno, os, pywintypes, win32con, win32file, win32process
18 18 import cStringIO, winerror
19 import osutil
19 20 from win32com.shell import shell,shellcon
20 21
21 22 class WinError:
@@ -179,6 +180,20 def testpid(pid):
179 180
180 181 def system_rcpath_win32():
181 182 '''return default os-specific hgrc search path'''
183 try:
184 value = win32api.RegQueryValue(
185 win32con.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Mercurial')
186 rcpath = []
187 for p in value.split(os.pathsep):
188 if p.lower().endswith('mercurial.ini'):
189 rcpath.append(p)
190 elif os.path.isdir(p):
191 for f, kind in osutil.listdir(p):
192 if f.endswith('.rc'):
193 rcpath.append(os.path.join(p, f))
194 return rcpath
195 except pywintypes.error:
196 pass
182 197 proc = win32api.GetCurrentProcess()
183 198 try:
184 199 # This will fail on windows < NT
General Comments 0
You need to be logged in to leave comments. Login now