Mercurial > hg-stable
changeset 15320:681267a5f491 stable
largefiles: use XDG and OS X-specific cache locations by default (issue3067)
author | Benjamin Pollack <benjamin@bitquabit.com> |
---|---|
date | Thu, 20 Oct 2011 17:05:13 -0400 |
parents | 9da7e96cd5c2 |
children | e174353e8cda |
files | hgext/largefiles/lfutil.py |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py Wed Oct 19 20:40:55 2011 -0400 +++ b/hgext/largefiles/lfutil.py Thu Oct 20 17:05:13 2011 -0400 @@ -10,6 +10,7 @@ import os import errno +import platform import shutil import stat import hashlib @@ -88,8 +89,15 @@ if os.name == 'nt': appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) path = os.path.join(appdata, longname, hash) + elif platform.system() == 'Darwin': + path = os.path.join(os.getenv('HOME'), 'Library', 'Caches', + longname, hash) elif os.name == 'posix': - path = os.path.join(os.getenv('HOME'), '.' + longname, hash) + path = os.getenv('XDG_CACHE_HOME') + if path: + path = os.path.join(path, longname, hash) + else: + path = os.path.join(os.getenv('HOME'), '.cache', longname, hash) else: raise util.Abort(_('unknown operating system: %s\n') % os.name) return path