Use QFileInfo::exists where we are only creating a QFileInfo to check if file exists, as it is faster

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
Claudio Cambra 2022-12-19 17:46:27 +01:00 committed by Matthieu Gallien
parent 7f6b18b232
commit f6c4c32b6e
2 changed files with 5 additions and 5 deletions

View file

@ -493,24 +493,24 @@ void User::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
continue;
}
if (activity._syncFileItemStatus == SyncFileItem::Conflict && !QFileInfo(f->path() + activity._file).exists()) {
if (activity._syncFileItemStatus == SyncFileItem::Conflict && !QFileInfo::exists(f->path() + activity._file)) {
_activityModel->removeActivityFromActivityList(activity);
continue;
}
if (activity._syncFileItemStatus == SyncFileItem::FileLocked && !QFileInfo(f->path() + activity._file).exists()) {
if (activity._syncFileItemStatus == SyncFileItem::FileLocked && !QFileInfo::exists(f->path() + activity._file)) {
_activityModel->removeActivityFromActivityList(activity);
continue;
}
if (activity._syncFileItemStatus == SyncFileItem::FileIgnored && !QFileInfo(f->path() + activity._file).exists()) {
if (activity._syncFileItemStatus == SyncFileItem::FileIgnored && !QFileInfo::exists(f->path() + activity._file)) {
_activityModel->removeActivityFromActivityList(activity);
continue;
}
if (!QFileInfo(f->path() + activity._file).exists()) {
if (!QFileInfo::exists(f->path() + activity._file)) {
_activityModel->removeActivityFromActivityList(activity);
continue;
}

View file

@ -286,7 +286,7 @@ void SyncEngine::conflictRecordMaintenance()
const auto conflictRecordPaths = _journal->conflictRecordPaths();
for (const auto &path : conflictRecordPaths) {
auto fsPath = _propagator->fullLocalPath(QString::fromUtf8(path));
if (!QFileInfo(fsPath).exists()) {
if (!QFileInfo::exists(fsPath)) {
_journal->deleteConflictRecord(path);
}
}