From: Johan Dahlin Date: Mon, 8 Dec 2008 20:05:29 +0000 (+0000) Subject: Don't require HOME to be set and if it set, don't require the directory to X-Git-Tag: GOBJECT_INTROSPECTION_0_6_2~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=076bf783f0a4e1362f08cbc2dd986f85a8afaf5f;p=platform%2Fupstream%2Fgobject-introspection.git Don't require HOME to be set and if it set, don't require the directory to 2008-12-08 Johan Dahlin * 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 --- diff --git a/ChangeLog b/ChangeLog index ba52604..947f80e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-12-08 Johan Dahlin + * 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 + * 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. diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py index b2fee6a..f7f0062 100644 --- a/giscanner/cachestore.py +++ b/giscanner/cachestore.py @@ -26,7 +26,13 @@ import tempfile 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)