[Pkg-owncloud-commits] [owncloud-client] 51/83: Check for case preserving file system in localCaseClash

Sandro Knauß hefee-guest at moszumanska.debian.org
Sat May 31 11:31:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 181383e5f181c1e2dddc86ed7763d4a7a1703bc0
Author: Klaas Freitag <freitag at owncloud.com>
Date:   Mon May 26 17:52:24 2014 +0200

    Check for case preserving file system in localCaseClash
---
 src/mirall/owncloudpropagator.cpp | 46 +++++++++++++++++++++------------------
 1 file changed, 25 insertions(+), 21 deletions(-)

diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp
index 45a670a..888f866 100644
--- a/src/mirall/owncloudpropagator.cpp
+++ b/src/mirall/owncloudpropagator.cpp
@@ -305,32 +305,36 @@ bool OwncloudPropagator::localFileNameClash( const QString& relFile )
 {
     bool re = false;
     const QString file( _localDir + relFile );
-    qDebug() << "CaseClashCheck for " << file;
-#ifdef Q_OS_OSX
-    QFileInfo fileInfo(file);
-    if (!fileInfo.exists())
-        re = false;
-    else
-        re = ( ! file.endsWith(fileInfo.canonicalFilePath(), Qt::CaseSensitive) );
 
-#elif defined(Q_OS_WIN)
-    WIN32_FIND_DATA FindFileData;
-    HANDLE hFind;
+    if( !file.isEmpty() && Utility::fsCasePreserving() ) {
+#ifdef Q_OS_MAC
+        QFileInfo fileInfo(file);
+        if (!fileInfo.exists())
+            re = false;
+        else
+            re = ( ! file.endsWith(fileInfo.canonicalFilePath(), Qt::CaseSensitive) );
 
-    hFind = FindFirstFileW( (wchar_t*)file.utf16(), &FindFileData);
-    if (hFind == INVALID_HANDLE_VALUE) {
-        qDebug() << "FindFirstFile failed " << GetLastError();
-        // returns false.
-    } else {
-        QString realFileName = QString::fromWCharArray( FindFileData.cFileName );
-        qDebug() << Q_FUNC_INFO << "Real file name is " << realFileName;
-        FindClose(hFind);
+#elif defined(Q_OS_WIN)
+        const QString file( _localDir + relFile );
+        qDebug() << "CaseClashCheck for " << file;
+        WIN32_FIND_DATA FindFileData;
+        HANDLE hFind;
+
+        hFind = FindFirstFileW( (wchar_t*)file.utf16(), &FindFileData);
+        if (hFind == INVALID_HANDLE_VALUE) {
+            qDebug() << "FindFirstFile failed " << GetLastError();
+            // returns false.
+        } else {
+            QString realFileName = QString::fromWCharArray( FindFileData.cFileName );
+            qDebug() << Q_FUNC_INFO << "Real file name is " << realFileName;
+            FindClose(hFind);
 
-        if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) {
-            re = true;
+            if( ! file.endsWith(realFileName, Qt::CaseSensitive) ) {
+                re = true;
+            }
         }
-    }
 #endif
+    }
     return re;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list