comparison installer.cpp @ 52:eeab56dd59d6

Copy in metadata files as well
author Chris Cannam
date Thu, 30 Jan 2020 15:15:49 +0000
parents cf2840ba1e07
children c1e5e3f02e48
comparison
equal deleted inserted replaced
51:cf2840ba1e07 52:eeab56dd59d6
194 } 194 }
195 195
196 void 196 void
197 installLibrary(QString library, QString target) 197 installLibrary(QString library, QString target)
198 { 198 {
199 QFile f(":out/" + library); 199 QString source = ":out";
200 QFile f(source + "/" + library);
200 QString destination = target + "/" + library; 201 QString destination = target + "/" + library;
202
201 SVCERR << "Copying " << library.toStdString() << " to " 203 SVCERR << "Copying " << library.toStdString() << " to "
202 << destination.toStdString() << "..." << endl; 204 << destination.toStdString() << "..." << endl;
203 if (!f.copy(destination)) { 205 if (!f.copy(destination)) {
204 SVCERR << "Failed to copy " << library.toStdString() 206 SVCERR << "Failed to copy " << library.toStdString()
205 << " to target " << destination.toStdString() << endl; 207 << " to target " << destination.toStdString() << endl;
211 QFile::ReadGroup | QFile::ExeGroup | 213 QFile::ReadGroup | QFile::ExeGroup |
212 QFile::ReadOther | QFile::ExeOther)) { 214 QFile::ReadOther | QFile::ExeOther)) {
213 SVCERR << "Failed to set permissions on " 215 SVCERR << "Failed to set permissions on "
214 << library.toStdString() << endl; 216 << library.toStdString() << endl;
215 return; 217 return;
218 }
219
220 QString base = QFileInfo(library).baseName();
221 QDir dir(source);
222 auto entries = dir.entryList({ base + "*" });
223 for (auto e: entries) {
224 if (e == library) continue;
225 QString destination = target + "/" + e;
226 SVCERR << "Copying " << e.toStdString() << " to "
227 << destination.toStdString() << "..." << endl;
228 if (!QFile(source + "/" + e).copy(destination)) {
229 SVCERR << "Failed to copy " << e.toStdString()
230 << " to target " << destination.toStdString()
231 << " (ignoring)" << endl;
232 }
216 } 233 }
217 } 234 }
218 235
219 QStringList 236 QStringList
220 getUserApprovedPluginLibraries(vector<LibraryInfo> libraries) 237 getUserApprovedPluginLibraries(vector<LibraryInfo> libraries)
368 auto rdfStore = loadLibrariesRdf(); 385 auto rdfStore = loadLibrariesRdf();
369 386
370 auto info = getLibraryInfo(*rdfStore, libraries); 387 auto info = getLibraryInfo(*rdfStore, libraries);
371 388
372 QStringList toInstall = getUserApprovedPluginLibraries(info); 389 QStringList toInstall = getUserApprovedPluginLibraries(info);
390
391 if (!toInstall.empty()) {
392 if (!QDir(target).exists()) {
393 QDir().mkpath(target);
394 }
395 }
373 396
374 for (auto lib: toInstall) { 397 for (auto lib: toInstall) {
375 installLibrary(lib, target); 398 installLibrary(lib, target);
376 } 399 }
377 400