diff options
author | allexzander <blackslayer4@gmail.com> | 2021-05-31 18:30:20 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-06-08 12:25:43 +0300 |
commit | bb55232e8ee6afbbfce5effda76961d6444f7926 (patch) | |
tree | 071957fc668fe7c485287a02ee084f7f6136e72f | |
parent | 1951eec009a7832c7c12b7313bdca4992b6217e3 (diff) |
VFS freeze fix. Treat .sync-exclude.lst as a non-virtual file always.
Signed-off-by: allexzander <blackslayer4@gmail.com>
-rw-r--r-- | src/common/filesystembase.cpp | 5 | ||||
-rw-r--r-- | src/common/filesystembase.h | 5 | ||||
-rw-r--r-- | src/libsync/discovery.cpp | 3 | ||||
-rw-r--r-- | src/libsync/vfs/cfapi/vfs_cfapi.cpp | 4 |
4 files changed, 15 insertions, 2 deletions
diff --git a/src/common/filesystembase.cpp b/src/common/filesystembase.cpp index 3fc067944..ffc7bca4f 100644 --- a/src/common/filesystembase.cpp +++ b/src/common/filesystembase.cpp @@ -480,6 +480,11 @@ bool FileSystem::isLnkFile(const QString &filename) return filename.endsWith(QLatin1String(".lnk")); } +bool FileSystem::isExcludeFile(const QString &filename) +{ + return filename.endsWith(QLatin1String(".sync-exclude.lst")); +} + bool FileSystem::isJunction(const QString &filename) { #ifdef Q_OS_WIN diff --git a/src/common/filesystembase.h b/src/common/filesystembase.h index 0259fb6c7..b15cb4fa1 100644 --- a/src/common/filesystembase.h +++ b/src/common/filesystembase.h @@ -154,6 +154,11 @@ namespace FileSystem { bool OCSYNC_EXPORT isLnkFile(const QString &filename); /** + * Returns whether the file is an exclude file (contains patterns to exclude from sync) + */ + bool OCSYNC_EXPORT isExcludeFile(const QString &filename); + + /** * Returns whether the file is a junction (windows only) */ bool OCSYNC_EXPORT isJunction(const QString &filename); diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index 5b0873bdd..530f67a51 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -521,7 +521,8 @@ void ProcessDirectoryJob::processFileAnalyzeRemoteInfo( if (!localEntry.isValid() && item->_type == ItemTypeFile && opts._vfs->mode() != Vfs::Off - && _pinState != PinState::AlwaysLocal) { + && _pinState != PinState::AlwaysLocal + && !FileSystem::isExcludeFile(item->_file)) { item->_type = ItemTypeVirtualFile; if (isVfsWithSuffix()) addVirtualFileSuffix(tmp_path._original); diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 9a8e81353..5db9c5d03 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -187,6 +187,8 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) const auto isWindowsShortcut = !isDirectory && FileSystem::isLnkFile(stat->path); + const auto isExcludeFile = !isDirectory && FileSystem::isExcludeFile(stat->path); + // It's a dir with a reparse point due to the placeholder info (hence the cloud tag) // if we don't remove the reparse point flag the discovery will end up thinking // it is a file... let's prevent it @@ -198,7 +200,7 @@ bool VfsCfApi::statTypeVirtualFile(csync_file_stat_t *stat, void *statData) } else if (isSparseFile && isPinned) { stat->type = ItemTypeVirtualFileDownload; return true; - } else if (!isSparseFile && isUnpinned && !isWindowsShortcut){ + } else if (!isSparseFile && isUnpinned && !isWindowsShortcut && !isExcludeFile) { stat->type = ItemTypeVirtualFileDehydration; return true; } else if (isSparseFile) { |