Skip to content

Commit

Permalink
Refactor a bit ConfigFile::setupDefaultExcludeFilePaths.
Browse files Browse the repository at this point in the history
Signed-off-by: Camila <[email protected]>
  • Loading branch information
Camila committed Aug 31, 2023
1 parent 29bd03d commit 69a3ce9
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/libsync/configfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1163,24 +1163,23 @@ void ConfigFile::setupDefaultExcludeFilePaths(ExcludedFiles &excludedFiles)

if (!QFile::exists(userList)) {
qCInfo(lcConfigFile) << "User defined ignore list does not exist:" << userList;
qCInfo(lcConfigFile) << "Migrating legacy list" << legacyList << "or system list" << systemList;

if (QFile::exists(legacyList)) {
if (!QFile::copy(legacyList, userList)) {
qCInfo(lcConfigFile) << "Could not copy over legacy list from" << legacyList << "to" << userList;
}
} else if (!QFile::copy(systemList, userList)) {
qCInfo(lcConfigFile) << "Could not copy over system list from" << systemList << "to" << userList;
if (QFile::exists(legacyList) && QFile::copy(legacyList, userList)) {
qCInfo(lcConfigFile) << "Migrating legacy list" << legacyList << "to user list" << userList;

} else if (QFile::copy(systemList, userList)) {
qCInfo(lcConfigFile) << "Migrating system list" << legacyList << "to user list" << 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);
return;
}

qCInfo(lcConfigFile) << "Adding user defined ignore list to csync:" << userList;
excludedFiles.addExcludeFilePath(userList);
}

QString ConfigFile::discoveredLegacyConfigPath()
Expand Down

0 comments on commit 69a3ce9

Please sign in to comment.