hgext/largefiles/lfutil.py
changeset 30664 69acfd2ca11e
parent 30640 7a3e67bfa417
child 30820 6a70cf94d1b5
equal deleted inserted replaced
30663:bb0d5aad761a 30664:69acfd2ca11e
    72     '''Return the location of the "global" largefiles cache.'''
    72     '''Return the location of the "global" largefiles cache.'''
    73     path = ui.configpath(longname, 'usercache', None)
    73     path = ui.configpath(longname, 'usercache', None)
    74     if path:
    74     if path:
    75         return path
    75         return path
    76     if pycompat.osname == 'nt':
    76     if pycompat.osname == 'nt':
    77         appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA'))
    77         appdata = pycompat.osgetenv('LOCALAPPDATA',\
       
    78                         pycompat.osgetenv('APPDATA'))
    78         if appdata:
    79         if appdata:
    79             return os.path.join(appdata, longname)
    80             return os.path.join(appdata, longname)
    80     elif platform.system() == 'Darwin':
    81     elif platform.system() == 'Darwin':
    81         home = os.getenv('HOME')
    82         home = pycompat.osgetenv('HOME')
    82         if home:
    83         if home:
    83             return os.path.join(home, 'Library', 'Caches', longname)
    84             return os.path.join(home, 'Library', 'Caches', longname)
    84     elif pycompat.osname == 'posix':
    85     elif pycompat.osname == 'posix':
    85         path = os.getenv('XDG_CACHE_HOME')
    86         path = pycompat.osgetenv('XDG_CACHE_HOME')
    86         if path:
    87         if path:
    87             return os.path.join(path, longname)
    88             return os.path.join(path, longname)
    88         home = os.getenv('HOME')
    89         home = pycompat.osgetenv('HOME')
    89         if home:
    90         if home:
    90             return os.path.join(home, '.cache', longname)
    91             return os.path.join(home, '.cache', longname)
    91     else:
    92     else:
    92         raise error.Abort(_('unknown operating system: %s\n')
    93         raise error.Abort(_('unknown operating system: %s\n')
    93                           % pycompat.osname)
    94                           % pycompat.osname)