From c4061147220f8130239e8d12836a8473b37d4f2c Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 22 Sep 2010 16:07:39 -0600 Subject: [PATCH] Fix #6914 (Calibre misfiles books (during a rename?)) --- src/calibre/library/database2.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 1a2eef2c81..08d9dc3edd 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -451,6 +451,10 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): parent = os.path.dirname(spath) if len(os.listdir(parent)) == 0: self.rmtree(parent, permanent=True) + ''' + This is commented out as it can lead to book file loss if the second + rename fails. This makes it not worthwhile, IMO. + curpath = self.library_path c1, c2 = current_path.split('/'), path.split('/') if not self.is_case_sensitive and len(c1) == len(c2): @@ -473,6 +477,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): os.rename(os.path.join(curpath, oldseg), tempname) os.rename(tempname, os.path.join(curpath, newseg)) curpath = os.path.join(curpath, newseg) + ''' def add_listener(self, listener): '''