# HG changeset patch # User Matt Mackall # Date 1323989421 21600 # Node ID c7b0bedbb07ac3752243db046f54c9a4bbc3273d # Parent 7fba5a245accb8d7ec3b3c6e540542819d0ef8e4# Parent 971c55ce03b81cc71ea33342bc432cc359e79e2a merge with stable diff -r 7fba5a245acc -r c7b0bedbb07a hgext/largefiles/lfutil.py --- a/hgext/largefiles/lfutil.py Thu Dec 15 23:08:09 2011 +0100 +++ b/hgext/largefiles/lfutil.py Thu Dec 15 16:50:21 2011 -0600 @@ -91,22 +91,28 @@ else: if os.name == 'nt': appdata = os.getenv('LOCALAPPDATA', os.getenv('APPDATA')) - path = os.path.join(appdata, longname, hash) + if appdata: + path = os.path.join(appdata, longname, hash) elif platform.system() == 'Darwin': - path = os.path.join(os.getenv('HOME'), 'Library', 'Caches', - longname, hash) + home = os.getenv('HOME') + if home: + path = os.path.join(home, 'Library', 'Caches', + longname, hash) elif os.name == 'posix': 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) + home = os.getenv('HOME') + if home: + path = os.path.join(home, '.cache', longname, hash) else: raise util.Abort(_('unknown operating system: %s\n') % os.name) return path def inusercache(ui, hash): - return os.path.exists(usercachepath(ui, hash)) + path = usercachepath(ui, hash) + return path and os.path.exists(path) def findfile(repo, hash): if instore(repo, hash): @@ -239,8 +245,10 @@ linktousercache(repo, hash) def linktousercache(repo, hash): - util.makedirs(os.path.dirname(usercachepath(repo.ui, hash))) - link(storepath(repo, hash), usercachepath(repo.ui, hash)) + path = usercachepath(repo.ui, hash) + if path: + util.makedirs(os.path.dirname(path)) + link(storepath(repo, hash), path) def getstandinmatcher(repo, pats=[], opts={}): '''Return a match object that applies pats to the standin directory'''