changeset 52:eeab56dd59d6

Copy in metadata files as well
author Chris Cannam
date Thu, 30 Jan 2020 15:15:49 +0000
parents cf2840ba1e07
children c1e5e3f02e48
files installer.cpp
diffstat 1 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/installer.cpp	Thu Jan 30 13:28:32 2020 +0000
+++ b/installer.cpp	Thu Jan 30 15:15:49 2020 +0000
@@ -196,8 +196,10 @@
 void
 installLibrary(QString library, QString target)
 {
-    QFile f(":out/" + library);
+    QString source = ":out";
+    QFile f(source + "/" + library);
     QString destination = target + "/" + library;
+    
     SVCERR << "Copying " << library.toStdString() << " to "
            << destination.toStdString() << "..." << endl;
     if (!f.copy(destination)) {
@@ -214,6 +216,21 @@
                << library.toStdString() << endl;
         return;
     }
+
+    QString base = QFileInfo(library).baseName();
+    QDir dir(source);
+    auto entries = dir.entryList({ base + "*" });
+    for (auto e: entries) {
+        if (e == library) continue;
+        QString destination = target + "/" + e;
+        SVCERR << "Copying " << e.toStdString() << " to "
+               << destination.toStdString() << "..." << endl;
+        if (!QFile(source + "/" + e).copy(destination)) {
+            SVCERR << "Failed to copy " << e.toStdString()
+                   << " to target " << destination.toStdString()
+                   << " (ignoring)" << endl;
+        }
+    }
 }
 
 QStringList
@@ -370,6 +387,12 @@
     auto info = getLibraryInfo(*rdfStore, libraries);
     
     QStringList toInstall = getUserApprovedPluginLibraries(info);
+
+    if (!toInstall.empty()) {
+        if (!QDir(target).exists()) {
+            QDir().mkpath(target);
+        }
+    }
     
     for (auto lib: toInstall) {
         installLibrary(lib, target);