##// END OF EJS Templates
util: disinfect lookup_reg strings (issue1126)...
Matt Mackall -
r6880:892806b3 default
parent child Browse files
Show More
@@ -201,21 +201,17 def lookup_reg(key, valname=None, scope=
201 201 except ImportError:
202 202 return None
203 203
204 def query_val(scope, key, valname):
205 try:
206 keyhandle = OpenKey(scope, key)
207 return QueryValueEx(keyhandle, valname)[0]
208 except EnvironmentError:
209 return None
210
211 204 if scope is None:
212 205 scope = (HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE)
213 206 elif not isinstance(scope, (list, tuple)):
214 207 scope = (scope,)
215 208 for s in scope:
216 val = query_val(s, key, valname)
217 if val is not None:
218 return val
209 try:
210 val = QueryValueEx(OpenKey(scope, key), valname)[0]
211 # never let a Unicode string escape into the wild
212 return util.tolocal(val.encode('UTF-8'))
213 except EnvironmentError:
214 pass
219 215
220 216 def system_rcpath_win32():
221 217 '''return default os-specific hgrc search path'''
General Comments 0
You need to be logged in to leave comments. Login now