##// 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 b' FILES'
17
17
18 Mercurial reads configuration data from several files, if they exist.
18 Mercurial reads configuration data from several files, if they exist.
19 The names of these files depend on the system on which Mercurial is
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 (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc::
24 (Unix) <install-root>/etc/mercurial/hgrc.d/*.rc::
23 (Unix) <install-root>/etc/mercurial/hgrc::
25 (Unix) <install-root>/etc/mercurial/hgrc::
@@ -29,6 +31,8 b' installed.'
29
31
30 (Unix) /etc/mercurial/hgrc.d/*.rc::
32 (Unix) /etc/mercurial/hgrc.d/*.rc::
31 (Unix) /etc/mercurial/hgrc::
33 (Unix) /etc/mercurial/hgrc::
34 (Windows) HKEY_LOCAL_MACHINE\SOFTWARE\Mercurial::
35 or::
32 (Windows) C:\Mercurial\Mercurial.ini::
36 (Windows) C:\Mercurial\Mercurial.ini::
33 Per-system configuration files, for the system on which Mercurial
37 Per-system configuration files, for the system on which Mercurial
34 is running. Options in these files apply to all Mercurial
38 is running. Options in these files apply to all Mercurial
@@ -16,6 +16,7 b' import win32api'
16 from i18n import _
16 from i18n import _
17 import errno, os, pywintypes, win32con, win32file, win32process
17 import errno, os, pywintypes, win32con, win32file, win32process
18 import cStringIO, winerror
18 import cStringIO, winerror
19 import osutil
19 from win32com.shell import shell,shellcon
20 from win32com.shell import shell,shellcon
20
21
21 class WinError:
22 class WinError:
@@ -179,6 +180,20 b' def testpid(pid):'
179
180
180 def system_rcpath_win32():
181 def system_rcpath_win32():
181 '''return default os-specific hgrc search path'''
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 proc = win32api.GetCurrentProcess()
197 proc = win32api.GetCurrentProcess()
183 try:
198 try:
184 # This will fail on windows < NT
199 # This will fail on windows < NT
General Comments 0
You need to be logged in to leave comments. Login now