From 6cc496633fe09f0e51848412886d5048553ad193 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 19 Nov 2018 15:35:32 +0100 Subject: Do not read system exclude list if user exclude is present For #566 Since we only showed the user exclude list (and some extra items) the system exclude list was still used. This copies over the system exclude list (if it isn't there). If it fails we use the system one still. However if you now remove items from your own list it will really be gone. Signed-off-by: Roeland Jago Douma --- src/libsync/configfile.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/libsync/configfile.cpp b/src/libsync/configfile.cpp index c94cb7c9f..5fb2ef10f 100644 --- a/src/libsync/configfile.cpp +++ b/src/libsync/configfile.cpp @@ -842,11 +842,19 @@ void ConfigFile::setupDefaultExcludeFilePaths(ExcludedFiles &excludedFiles) { ConfigFile cfg; QString systemList = cfg.excludeFile(ConfigFile::SystemScope); - qCInfo(lcConfigFile) << "Adding system ignore list to csync:" << systemList; - excludedFiles.addExcludeFilePath(systemList); - QString userList = cfg.excludeFile(ConfigFile::UserScope); - if (QFile::exists(userList)) { + + if (!QFile::exists(userList)) { + qCInfo(lcConfigFile) << "User defined ignore list does not exist:" << userList; + if (!QFile::copy(systemList, userList)) { + qCInfo(lcConfigFile) << "Could not copy over default list to:" << userList; + } + } + + if (!QFile::exists(userList)) { + qCInfo(lcConfigFile) << "Adding system ignore list to csync:" << systemList; + excludedFiles.addExcludeFilePath(systemList); + } else { qCInfo(lcConfigFile) << "Adding user defined ignore list to csync:" << userList; excludedFiles.addExcludeFilePath(userList); } -- cgit v1.2.3