]> git.lyx.org Git - lyx.git/commitdiff
Don't need to remove the file if it doesn't exist. (This would cause a five second...
authorRichard Kimberly Heck <rikiheck@lyx.org>
Mon, 3 Feb 2020 16:37:12 +0000 (11:37 -0500)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Thu, 6 Feb 2020 20:02:39 +0000 (15:02 -0500)
Fixes bug #11728.

(cherry picked from commit 5188f0fcff49bbbee35193c25b726425c8c02287)
(cherry picked from commit e60d5df4b30adfb25825a488aec64aaebfccca33)

src/support/FileName.cpp

index e30609fe923c7b8d1b6070e1b42fa0d461845c6c..5f64bbfe760c68d5130e4716b8d51d9193ad0428 100644 (file)
@@ -264,12 +264,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());