2008-12-08 Johan Dahlin <johan@async.com.br>
* giscanner/cachestore.py (_get_cachedir): Don't require
HOME to be set and if it set, don't require the
directory to exist.
svn path=/trunk/; revision=987
2008-12-08 Johan Dahlin <johan@async.com.br>
+ * giscanner/cachestore.py (_get_cachedir): Don't require
+ HOME to be set and if it set, don't require the
+ directory to exist.
+
+2008-12-08 Johan Dahlin <johan@async.com.br>
+
* giscanner/cachestore.py (CacheStore.store): Dump the cache
file to a temporary file and rename it the expected filename
only when it's completely written.
def _get_cachedir():
- cachedir = os.path.join(os.environ['HOME'], '.cache')
+ homedir = os.environ.get('HOME')
+ if homedir is None:
+ return None
+ if not os.path.exists(homedir):
+ return None
+
+ cachedir = os.path.join(homedir, '.cache')
if not os.path.exists(cachedir):
os.mkdir(cachedir, 0755)