Never ignore .sync-exclude, even if excludeHidden

That is unless any of the parent folders is hidden.

Signed-off-by: Samir Benmendil <me@rmz.io>
This commit is contained in:
Samir Benmendil 2019-08-14 23:27:10 +01:00
parent 758483bc6e
commit 34fcb13e78
3 changed files with 14 additions and 4 deletions

View file

@ -343,15 +343,15 @@ bool ExcludedFiles::isExcluded(
return true;
}
//TODO this seems a waste, hidden files are ignored before hitting this function it seems
if (excludeHidden) {
QString path = filePath;
// Check all path subcomponents, but to *not* check the base path:
// We do want to be able to sync with a hidden folder as the target.
while (path.size() > basePath.size()) {
QFileInfo fi(path);
//TODO probably not ignore `.sync-exclude.lst` files as it makes sense for them to be
//synced
if (fi.isHidden() || fi.fileName().startsWith(QLatin1Char('.'))) {
if (fi.fileName() != ".sync-exclude.lst"
&& (fi.isHidden() || fi.fileName().startsWith(QLatin1Char('.')))) {
return true;
}

View file

@ -124,7 +124,9 @@ static int _csync_detect_update(CSYNC *ctx, std::unique_ptr<csync_file_stat_t> f
* because it's a hidden file that should not be synced.
* This code should probably be in csync_exclude, but it does not have the fs parameter.
* Keep it here for now */
if (ctx->ignore_hidden_files && (fs->is_hidden)) {
if (ctx->ignore_hidden_files
&& fs->is_hidden
&& !fs->path.endsWith(".sync-exclude.lst")) {
qCInfo(lcUpdate, "file excluded because it is a hidden file: %s", fs->path.constData());
excluded = CSYNC_FILE_EXCLUDE_HIDDEN;
}

View file

@ -47,6 +47,14 @@ IgnoreListEditor::IgnoreListEditor(QWidget *parent)
connect(this, &QDialog::accepted, [=]() {
ui->ignoreTableWidget->slotWriteIgnoreFile(userConfig);
/* handle the hidden file checkbox */
/* the ignoreHiddenFiles flag is a folder specific setting, but for now, it is
* handled globally. Save it to every folder that is defined.
* TODO this can now be fixed, simply attach this IgnoreListEditor to top-level account
* settings
*/
FolderMan::instance()->setIgnoreHiddenFiles(ignoreHiddenFiles());
});
connect(ui->buttonBox, &QDialogButtonBox::clicked,
this, &IgnoreListEditor::slotRestoreDefaults);