mercurial/rcutil.py
changeset 31680 448889f9a36c
parent 31679 0f8ba0bc1154
child 31681 294728f2a908
equal deleted inserted replaced
31679:0f8ba0bc1154 31680:448889f9a36c
    22     from . import scmposix as scmplatform
    22     from . import scmposix as scmplatform
    23 
    23 
    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
    41 
    38 
    42 def rcpath():
    39 def rcpath():
    58                         if f.endswith('.rc'):
    55                         if f.endswith('.rc'):
    59                             _rcpath.append(os.path.join(p, f))
    56                             _rcpath.append(os.path.join(p, f))
    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