From c092cf8d6698dad43a22f2baf6efb0f68e37ef0c Mon Sep 17 00:00:00 2001 From: Richard Kimberly Heck Date: Mon, 3 Feb 2020 11:37:12 -0500 Subject: [PATCH] Don't need to remove the file if it doesn't exist. (This would cause a five second delay in that case.) --- src/support/FileName.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/support/FileName.cpp b/src/support/FileName.cpp index 1c8cc2c92a..5579446704 100644 --- a/src/support/FileName.cpp +++ b/src/support/FileName.cpp @@ -272,12 +272,14 @@ bool FileName::moveTo(FileName const & name) const // there's a locking problem on Windows sometimes, so // we will keep trying for five seconds, in the hope // that clears. - bool removed = QFile::remove(name.d->fi.absoluteFilePath()); - int tries = 1; - while (!removed && tries < 6) { - QThread::sleep(1); - removed = QFile::remove(name.d->fi.absoluteFilePath()); - tries++; + if (name.exists()) { + bool removed = QFile::remove(name.d->fi.absoluteFilePath()); + int tries = 1; + while (!removed && tries < 6) { + QThread::sleep(1); + removed = QFile::remove(name.d->fi.absoluteFilePath()); + tries++; + } } #else QFile::remove(name.d->fi.absoluteFilePath()); -- 2.39.5