changeset 94:b2e0b5d4cc5a

Avoid creating more than one backup dir
author Chris Cannam
date Thu, 27 Feb 2020 15:04:53 +0000
parents 5ac455fba0ed
children 24d64a983fc8
files .hgignore installer.cpp
diffstat 2 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Thu Feb 27 14:28:03 2020 +0000
+++ b/.hgignore	Thu Feb 27 15:04:53 2020 +0000
@@ -46,7 +46,8 @@
 *.dmg
 *.app
 installer.qrc
-Dockerfile.gen
+Dockerfile*.gen
 plugins.zip
 get-version
 output.tar
+deploy/linux/docker/output
--- a/installer.cpp	Thu Feb 27 14:28:03 2020 +0000
+++ b/installer.cpp	Thu Feb 27 15:04:53 2020 +0000
@@ -586,9 +586,17 @@
     QString source = ":out";
     QFile f(source + "/" + library);
     QString destination = targetDir + "/" + library;
-    QString backupDir = targetDir + "/" +
-        QString("saved-%1").arg(QDateTime::currentDateTime().toString
-                                 ("yyyyMMdd-hhmmss"));
+
+    static QString backupDirName;
+    if (backupDirName == "") {
+        // Static so as to be created once - don't go creating a
+        // second directory if the clock ticks over by one second
+        // between library installs
+        backupDirName = 
+            QString("saved-%1").arg(QDateTime::currentDateTime().toString
+                                    ("yyyyMMdd-hhmmss"));
+    }
+    QString backupDir = targetDir + "/" + backupDirName;
 
     if (!QDir(targetDir).exists()) {
         QDir().mkpath(targetDir);
@@ -969,6 +977,8 @@
         getUserApprovedPluginLibraries(info, target);
 
     if (toInstall.empty()) { // Cancelled, or nothing selected
+        SVCERR << "No libraries selected for installation, nothing to do"
+               << endl;
         return 0;
     }