From 0b9937d41d6dd30c24503c1344b15bd722148ae3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 28 Mar 2013 21:42:09 +0530 Subject: [PATCH] ... --- src/calibre/db/backend.py | 5 +++-- src/calibre/library/database2.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/calibre/db/backend.py b/src/calibre/db/backend.py index 19f8b0247f..9259fc628b 100644 --- a/src/calibre/db/backend.py +++ b/src/calibre/db/backend.py @@ -951,7 +951,8 @@ class DB(object): if samefile(dest, path): # Ensure that the file has the same case as dest try: - os.rename(path, dest) + if path != dest: + os.rename(path, dest) except: pass # Nothing too catastrophic happened, the cases mismatch, that's all else: @@ -964,7 +965,7 @@ class DB(object): dest.flush() elif dest: if samefile(dest, path): - if not self.is_case_sensitive: + if not self.is_case_sensitive and path != dest: # Ensure that the file has the same case as dest try: os.rename(path, dest) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index d398c3da3d..376eb52c3c 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -1347,7 +1347,8 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): if samefile(path, dest): # Ensure that the file has the same case as dest try: - os.rename(path, dest) + if path != dest: + os.rename(path, dest) except: pass # Nothing too catastrophic happened, the cases mismatch, that's all else: @@ -1360,7 +1361,7 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): dest.flush() elif dest: if samefile(dest, path): - if not self.is_case_sensitive: + if not self.is_case_sensitive and path != dest: # Ensure that the file has the same case as dest try: os.rename(path, dest)