mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Hidden Files: Add a setting to ignore hidden files or not.
This setting goes to the folder definition. By default, no hidden files are synced.
This commit is contained in:
parent
3a5f66e976
commit
a4336092f6
5 changed files with 11 additions and 1 deletions
|
@ -593,6 +593,7 @@ int csync_commit(CSYNC *ctx) {
|
|||
ctx->remote.read_from_db = 0;
|
||||
ctx->read_remote_from_db = true;
|
||||
ctx->db_is_empty = false;
|
||||
ctx->ignore_hidden_files = true; // do NOT sync hidden files by default.
|
||||
|
||||
|
||||
/* Create new trees */
|
||||
|
|
|
@ -168,6 +168,8 @@ struct csync_s {
|
|||
*/
|
||||
bool db_is_empty;
|
||||
|
||||
bool ignore_hidden_files;
|
||||
|
||||
struct csync_owncloud_ctx_s *owncloud_context;
|
||||
|
||||
};
|
||||
|
|
|
@ -177,7 +177,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file,
|
|||
} else {
|
||||
/* This code should probably be in csync_exclude, but it does not have the fs parameter.
|
||||
Keep it here for now */
|
||||
if (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN) {
|
||||
if (ctx->ignore_hidden_files && (fs->flags & CSYNC_VIO_FILE_FLAGS_HIDDEN)) {
|
||||
CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file excluded because it is a hidden file: %s", path);
|
||||
excluded = CSYNC_FILE_EXCLUDE_HIDDEN;
|
||||
}
|
||||
|
|
|
@ -813,6 +813,9 @@ void Folder::startSync(const QStringList &pathList)
|
|||
return;
|
||||
}
|
||||
|
||||
// pass the setting if hidden files are to be ignored, will be read in csync_update
|
||||
_csync_ctx->ignore_hidden_files = _definition.ignoreHiddenFiles;
|
||||
|
||||
_engine.reset(new SyncEngine( _accountState->account(), _csync_ctx, path(), remoteUrl().path(), remotePath(), &_journal));
|
||||
|
||||
qRegisterMetaType<SyncFileItemVector>("SyncFileItemVector");
|
||||
|
@ -1086,6 +1089,7 @@ void FolderDefinition::save(QSettings& settings, const FolderDefinition& folder)
|
|||
settings.setValue(QLatin1String("localPath"), folder.localPath);
|
||||
settings.setValue(QLatin1String("targetPath"), folder.targetPath);
|
||||
settings.setValue(QLatin1String("paused"), folder.paused);
|
||||
settings.setValue(QLatin1String("ignoreHiddenFiles"), folder.ignoreHiddenFiles);
|
||||
settings.endGroup();
|
||||
}
|
||||
|
||||
|
@ -1097,6 +1101,7 @@ bool FolderDefinition::load(QSettings& settings, const QString& alias,
|
|||
folder->localPath = settings.value(QLatin1String("localPath")).toString();
|
||||
folder->targetPath = settings.value(QLatin1String("targetPath")).toString();
|
||||
folder->paused = settings.value(QLatin1String("paused")).toBool();
|
||||
folder->ignoreHiddenFiles = settings.value(QLatin1String("ignoreHiddenFiles"), QVariant(true)).toBool();
|
||||
settings.endGroup();
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
QString targetPath;
|
||||
/// whether the folder is paused
|
||||
bool paused;
|
||||
/// whether the folder syncs hidden files
|
||||
bool ignoreHiddenFiles;
|
||||
|
||||
/// Saves the folder definition, creating a new settings group.
|
||||
static void save(QSettings& settings, const FolderDefinition& folder);
|
||||
|
|
Loading…
Reference in a new issue