mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-24 22:15:57 +03:00
Merge pull request #5271 from nextcloud/feature/removeObsoleteNames
Feature/remove obsolete names
This commit is contained in:
commit
a21df5b5ed
3 changed files with 9 additions and 6 deletions
|
@ -151,6 +151,9 @@ static CSYNC_EXCLUDE_TYPE _csync_excluded_common(const QString &path, bool exclu
|
||||||
if (bname.startsWith(QLatin1String(".owncloudsync.log"), Qt::CaseInsensitive)) { // ".owncloudsync.log*"
|
if (bname.startsWith(QLatin1String(".owncloudsync.log"), Qt::CaseInsensitive)) { // ".owncloudsync.log*"
|
||||||
return CSYNC_FILE_SILENTLY_EXCLUDED;
|
return CSYNC_FILE_SILENTLY_EXCLUDED;
|
||||||
}
|
}
|
||||||
|
if (bname.startsWith(QLatin1String(".nextcloudsync.log"), Qt::CaseInsensitive)) { // ".nextcloudsync.log*"
|
||||||
|
return CSYNC_FILE_SILENTLY_EXCLUDED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the strlen and ignore the file if its name is longer than 254 chars.
|
// check the strlen and ignore the file if its name is longer than 254 chars.
|
||||||
|
|
|
@ -1284,7 +1284,7 @@ void Folder::registerFolderWatcher()
|
||||||
connect(_folderWatcher.data(), &FolderWatcher::becameUnreliable,
|
connect(_folderWatcher.data(), &FolderWatcher::becameUnreliable,
|
||||||
this, &Folder::slotWatcherUnreliable);
|
this, &Folder::slotWatcherUnreliable);
|
||||||
_folderWatcher->init(path());
|
_folderWatcher->init(path());
|
||||||
_folderWatcher->startNotificatonTest(path() + QLatin1String(".owncloudsync.log"));
|
_folderWatcher->startNotificatonTest(path() + QLatin1String(".nextcloudsync.log"));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Folder::virtualFilesEnabled() const
|
bool Folder::virtualFilesEnabled() const
|
||||||
|
|
|
@ -301,12 +301,12 @@ void Logger::enterNextLogFile()
|
||||||
|
|
||||||
// Tentative new log name, will be adjusted if one like this already exists
|
// Tentative new log name, will be adjusted if one like this already exists
|
||||||
QDateTime now = QDateTime::currentDateTime();
|
QDateTime now = QDateTime::currentDateTime();
|
||||||
QString newLogName = now.toString("yyyyMMdd_HHmm") + "_owncloud.log";
|
QString newLogName = now.toString("yyyyMMdd_HHmm") + "_nextcloud.log";
|
||||||
|
|
||||||
// Expire old log files and deal with conflicts
|
// Expire old log files and deal with conflicts
|
||||||
QStringList files = dir.entryList(QStringList("*owncloud.log.*"),
|
QStringList files = dir.entryList(QStringList("*owncloud.log.*"), QDir::Files, QDir::Name) +
|
||||||
QDir::Files, QDir::Name);
|
dir.entryList(QStringList("*nextcloud.log.*"), QDir::Files, QDir::Name);
|
||||||
const QRegularExpression rx(QRegularExpression::anchoredPattern(R"(.*owncloud\.log\.(\d+).*)"));
|
const QRegularExpression rx(QRegularExpression::anchoredPattern(R"(.*(next|own)cloud\.log\.(\d+).*)"));
|
||||||
int maxNumber = -1;
|
int maxNumber = -1;
|
||||||
foreach (const QString &s, files) {
|
foreach (const QString &s, files) {
|
||||||
if (_logExpire > 0) {
|
if (_logExpire > 0) {
|
||||||
|
@ -317,7 +317,7 @@ void Logger::enterNextLogFile()
|
||||||
}
|
}
|
||||||
const auto rxMatch = rx.match(s);
|
const auto rxMatch = rx.match(s);
|
||||||
if (s.startsWith(newLogName) && rxMatch.hasMatch()) {
|
if (s.startsWith(newLogName) && rxMatch.hasMatch()) {
|
||||||
maxNumber = qMax(maxNumber, rxMatch.captured(1).toInt());
|
maxNumber = qMax(maxNumber, rxMatch.captured(2).toInt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newLogName.append("." + QString::number(maxNumber + 1));
|
newLogName.append("." + QString::number(maxNumber + 1));
|
||||||
|
|
Loading…
Reference in a new issue