From: APTX Date: Tue, 12 Feb 2013 19:58:04 +0000 (+0100) Subject: Do case insensitive path comparison during rename on windows. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=1ef936f6f2a4299e4aa3852e77e4231ffac48727;p=localmylist.git Do case insensitive path comparison during rename on windows. This solves the problem of having failed renames but doesn't actually do renames that only change case. --- diff --git a/localmylist/renamehandler.cpp b/localmylist/renamehandler.cpp index c250b9d..d8a8c2e 100644 --- a/localmylist/renamehandler.cpp +++ b/localmylist/renamehandler.cpp @@ -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; } }