owncloudcmd: Filter out empty lines in selectivesync

This commit is contained in:
Klaas Freitag 2015-04-12 12:59:25 +02:00
parent ec81cdefb0
commit 7b99877c68

View File

@ -445,7 +445,9 @@ restart_sync:
if (!f.open(QFile::ReadOnly)) {
qCritical() << "Could not open file containing the list of unsynced folders: " << options.unsyncedfolders;
} else {
selectiveSyncList = QString::fromUtf8(f.readAll()).split('\n');
// filter out empty lines and comments
selectiveSyncList = QString::fromUtf8(f.readAll()).split('\n').filter(QRegExp("\\S+")).filter(QRegExp("^[^#]"));
for (int i = 0; i < selectiveSyncList.count(); ++i) {
if (!selectiveSyncList.at(i).endsWith(QLatin1Char('/'))) {
selectiveSyncList[i].append(QLatin1Char('/'));