##// END OF EJS Templates
rcutil: split osrcpath to return default.d paths (API)...
Jun Wu -
r31680:448889f9 default
parent child Browse files
Show More
@@ -24,17 +24,14 b' else:'
24 systemrcpath = scmplatform.systemrcpath
24 systemrcpath = scmplatform.systemrcpath
25 userrcpath = scmplatform.userrcpath
25 userrcpath = scmplatform.userrcpath
26
26
27 def osrcpath():
27 def defaultrcpath():
28 '''return default os-specific hgrc search path'''
28 '''return rc paths in default.d'''
29 path = []
29 path = []
30 defaultpath = os.path.join(util.datapath, 'default.d')
30 defaultpath = os.path.join(util.datapath, 'default.d')
31 if os.path.isdir(defaultpath):
31 if os.path.isdir(defaultpath):
32 for f, kind in osutil.listdir(defaultpath):
32 for f, kind in osutil.listdir(defaultpath):
33 if f.endswith('.rc'):
33 if f.endswith('.rc'):
34 path.append(os.path.join(defaultpath, f))
34 path.append(os.path.join(defaultpath, f))
35 path.extend(systemrcpath())
36 path.extend(userrcpath())
37 path = [os.path.normpath(f) for f in path]
38 return path
35 return path
39
36
40 _rcpath = None
37 _rcpath = None
@@ -60,5 +57,6 b' def rcpath():'
60 else:
57 else:
61 _rcpath.append(p)
58 _rcpath.append(p)
62 else:
59 else:
63 _rcpath = osrcpath()
60 paths = defaultrcpath() + systemrcpath() + userrcpath()
61 _rcpath = pycompat.maplist(os.path.normpath, paths)
64 return _rcpath
62 return _rcpath
General Comments 0
You need to be logged in to leave comments. Login now