From 05dd9554f9d4f168f2cbd5a8157fe1a9337ad50a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 27 Oct 2015 16:06:38 +0100 Subject: [PATCH] SocketApi: Fix returning ignore for the root item all the time --- src/gui/folder.cpp | 10 +++++----- src/gui/socketapi.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gui/folder.cpp b/src/gui/folder.cpp index 5d3db6afe..d66b8d78a 100644 --- a/src/gui/folder.cpp +++ b/src/gui/folder.cpp @@ -703,16 +703,16 @@ void Folder::removeFromSettings() const bool Folder::isFileExcludedAbsolute(const QString& fullPath) const { + if (!fullPath.startsWith(path())) { + // Mark paths we're not responsible for as excluded... + return true; + } + QString myFullPath = fullPath; if (myFullPath.endsWith(QLatin1Char('/'))) { myFullPath.chop(1); } - if (!myFullPath.startsWith(path())) { - // Mark paths we're not responsible for as excluded... - return true; - } - QString relativePath = myFullPath.mid(path().size()); auto excl = ExcludedFiles::instance().isExcluded(myFullPath, relativePath, _definition.ignoreHiddenFiles); return excl != CSYNC_NOT_EXCLUDED; diff --git a/src/gui/socketapi.cpp b/src/gui/socketapi.cpp index 75190f710..a3ffa9327 100644 --- a/src/gui/socketapi.cpp +++ b/src/gui/socketapi.cpp @@ -542,8 +542,8 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa QString fileName = systemFileName.normalized(QString::NormalizationForm_C); QString fileNameSlash = fileName; - if( fileName != QLatin1String("/") && !fileName.isEmpty() ) { - file = folder->path() + fileName; + if(fileName != QLatin1String("/") && !fileName.isEmpty()) { + file += fileName; } if( fileName.endsWith(QLatin1Char('/')) ) { @@ -576,7 +576,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa } // Is it excluded? - if( folder->isFileExcludedAbsolute(file) ) { + if( folder->isFileExcludedRelative(fileName) ) { return SyncFileStatus(SyncFileStatus::STATUS_IGNORE); } @@ -591,7 +591,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa SyncJournalFileRecord rec = dbFileRecord_capi(folder, fileName ); if (folder->estimateState(fileName, type, &status)) { - qDebug() << Q_FUNC_INFO << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString(); + qDebug() << "Folder estimated status for" << fileName << "to" << status.toSocketAPIString(); } else if (fileName == "") { // sync folder itself switch (folder->syncResult().status()) { @@ -621,7 +621,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa if (rec.isValid()) { status.set(SyncFileStatus::STATUS_SYNC); } else { - qDebug() << Q_FUNC_INFO << "Could not determine state for folder" << fileName << "will set STATUS_NEW"; + qDebug() << "Could not determine state for folder" << fileName << "will set STATUS_NEW"; status.set(SyncFileStatus::STATUS_NEW); } } else if (type == CSYNC_FTW_TYPE_FILE) { @@ -636,7 +636,7 @@ SyncFileStatus SocketApi::fileStatus(Folder *folder, const QString& systemFileNa } } } else { - qDebug() << Q_FUNC_INFO << "Could not determine state for file" << fileName << "will set STATUS_NEW"; + qDebug() << "Could not determine state for file" << fileName << "will set STATUS_NEW"; status.set(SyncFileStatus::STATUS_NEW); } } -- 2.30.2