]> git.lyx.org Git - features.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)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:51 +0000 (15:48 +0200)
src/support/FileName.cpp

index 1c8cc2c92a220621ef7fc38d3736c22903245535..5579446704d5e2c803f44c8c5aa4fdadf01aadb5 100644 (file)
@@ -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());