From 517888c7425e68fdaabd3bc2199bee31d454036c Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Tue, 9 Dec 2008 15:19:57 +0000 Subject: Use shutil.move instead of os.rename, since it will automatically fall 2008-12-09 Johan Dahlin * giscanner/cachestore.py (CacheStore.store): Use shutil.move instead of os.rename, since it will automatically fall back to copying+remove if the src directory is on a different partition from the dst directory. svn path=/trunk/; revision=989 --- giscanner/cachestore.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'giscanner') diff --git a/giscanner/cachestore.py b/giscanner/cachestore.py index f7f0062a..5c4b5b49 100644 --- a/giscanner/cachestore.py +++ b/giscanner/cachestore.py @@ -22,6 +22,7 @@ import errno import cPickle import hashlib import os +import shutil import tempfile @@ -105,8 +106,8 @@ class CacheStore(object): raise try: - os.rename(tmp_filename, store_filename) - except OSError, e: + shutil.move(tmp_filename, store_filename) + except IOError, e: # Permission denied if e.errno == errno.EACCES: self._remove_filename(tmp_filename) -- cgit v1.2.1