diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-11-19 17:35:32 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-11-19 17:35:32 +0300 |
commit | 6cc496633fe09f0e51848412886d5048553ad193 (patch) | |
tree | 1318d2d71c54cf218ec110bfa2b22a16b3aad7e9 /src | |
parent | a3d1bd3a4249cbceaad1b9190691e8ed469f48db (diff) |
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 <roeland@famdouma.nl>
Diffstat (limited to 'src')
-rw-r--r-- | src/libsync/configfile.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
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); } |