72 '''Return the location of the "global" largefiles cache.''' |
73 '''Return the location of the "global" largefiles cache.''' |
73 path = ui.configpath(longname, 'usercache', None) |
74 path = ui.configpath(longname, 'usercache', None) |
74 if path: |
75 if path: |
75 return path |
76 return path |
76 if pycompat.osname == 'nt': |
77 if pycompat.osname == 'nt': |
77 appdata = pycompat.osgetenv('LOCALAPPDATA',\ |
78 appdata = encoding.environ.get('LOCALAPPDATA',\ |
78 pycompat.osgetenv('APPDATA')) |
79 encoding.environ.get('APPDATA')) |
79 if appdata: |
80 if appdata: |
80 return os.path.join(appdata, longname) |
81 return os.path.join(appdata, longname) |
81 elif platform.system() == 'Darwin': |
82 elif platform.system() == 'Darwin': |
82 home = pycompat.osgetenv('HOME') |
83 home = encoding.environ.get('HOME') |
83 if home: |
84 if home: |
84 return os.path.join(home, 'Library', 'Caches', longname) |
85 return os.path.join(home, 'Library', 'Caches', longname) |
85 elif pycompat.osname == 'posix': |
86 elif pycompat.osname == 'posix': |
86 path = pycompat.osgetenv('XDG_CACHE_HOME') |
87 path = encoding.environ.get('XDG_CACHE_HOME') |
87 if path: |
88 if path: |
88 return os.path.join(path, longname) |
89 return os.path.join(path, longname) |
89 home = pycompat.osgetenv('HOME') |
90 home = encoding.environ.get('HOME') |
90 if home: |
91 if home: |
91 return os.path.join(home, '.cache', longname) |
92 return os.path.join(home, '.cache', longname) |
92 else: |
93 else: |
93 raise error.Abort(_('unknown operating system: %s\n') |
94 raise error.Abort(_('unknown operating system: %s\n') |
94 % pycompat.osname) |
95 % pycompat.osname) |