]> Some of my projects - localmylist.git/commitdiff
Do case insensitive path comparison during rename on windows.
authorAPTX <marek321@gmail.com>
Tue, 12 Feb 2013 19:58:04 +0000 (20:58 +0100)
committerAPTX <marek321@gmail.com>
Tue, 12 Feb 2013 19:58:04 +0000 (20:58 +0100)
This solves the problem of having failed renames but doesn't actually do renames that only change case.

localmylist/renamehandler.cpp

index c250b9d91f0e82b348f854858f9e40b20863a0ae..d8a8c2efb968bdfe3a3f0249c2ad655515babbaf 100644 (file)
@@ -101,7 +101,11 @@ void RenameHandler::handleRename()
                QString newFileString = newFilePath + "/" + newFileName;
                QFileInfo newFile(newFileString);
 
+#ifdef Q_OS_WIN
+               bool isSamePath = oldFile.canonicalFilePath().compare(newFileString, Qt::CaseInsensitive) == 0;
+#else
                bool isSamePath = oldFile.canonicalFilePath() == newFileString;
+#endif
 
                if (isSamePath)
                {
@@ -124,7 +128,7 @@ void RenameHandler::handleRename()
                        {
                                fl.failedRename = true;
                                db->setFileLocation(fl);
-                               db->log(tr("Rename: Failed to rename file <%1>. Destination path <%2> does not exists and could not be created.").arg(oldFile.filePath()).arg(newFile.canonicalPath()), 2);
+                               db->log(tr("Rename: Failed to rename file <%1>. Destination path <%2> does not exist and could not be created.").arg(oldFile.filePath()).arg(newFile.canonicalPath()), 2);
                                continue;
                        }
                }