Mercurial > trustbridge
comparison ui/createinstallerdialog.cpp @ 979:01128d63226d
Copy the windows files recursively into the temporary directory
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Fri, 29 Aug 2014 14:28:00 +0200 |
parents | ad590fb9ab8f |
children | a162f4cbba75 |
comparison
equal
deleted
inserted
replaced
978:d92b1594e974 | 979:01128d63226d |
---|---|
381 return false; | 381 return false; |
382 } | 382 } |
383 return true; | 383 return true; |
384 } | 384 } |
385 | 385 |
386 bool copyPath(QString src, QString dst) | |
387 { | |
388 QDir dir(src); | |
389 if (! dir.exists()) { | |
390 qDebug() << "Source directory does not exist."; | |
391 return false; | |
392 } | |
393 | |
394 foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { | |
395 QString dst_path = dst + QDir::separator() + d; | |
396 dir.mkpath(dst_path); | |
397 if (!copyPath(src+ QDir::separator() + d, dst_path)) { | |
398 qDebug() << "Failed to copy subdirectory; " << d; | |
399 return false; | |
400 } | |
401 } | |
402 | |
403 foreach (QString f, dir.entryList(QDir::Files)) { | |
404 if (!QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f)) { | |
405 qDebug() << "Failed to copy: " << f; | |
406 return false; | |
407 } | |
408 } | |
409 return true; | |
410 } | |
386 | 411 |
387 QTemporaryDir *CreateInstallerDialog::codesignBinaries(const QDir& sourceDir) { | 412 QTemporaryDir *CreateInstallerDialog::codesignBinaries(const QDir& sourceDir) { |
388 QTemporaryDir* target = new QTemporaryDir(); | 413 QTemporaryDir* target = new QTemporaryDir(); |
389 /* Copy all files from the source dir to a temporary location */ | 414 /* Copy all files from the source dir to a temporary location */ |
390 mProgress.setLabelText(tr("Signing binaries...")); | 415 mProgress.setLabelText(tr("Signing binaries...")); |
391 | 416 |
392 mProgress.show(); | 417 mProgress.show(); |
418 | |
419 /* Copy the whole directory. */ | |
420 if (!copyPath(sourceDir.path(), target->path())) { | |
421 qDebug() << "Copy failed."; | |
422 showErrorMessage(tr("Failed to copy binaries to temporary location.")); | |
423 mProgress.cancel(); | |
424 return NULL; | |
425 } | |
426 /* Sign the top level .exe files */ | |
393 foreach (const QFileInfo& entry, sourceDir.entryInfoList()) { | 427 foreach (const QFileInfo& entry, sourceDir.entryInfoList()) { |
394 QString targetPath = target->path() + QString::fromLatin1("/") + entry.fileName(); | 428 QString targetPath = target->path() + QString::fromLatin1("/") + entry.fileName(); |
395 if (entry.fileName() == "." || entry.fileName() == "..") { | 429 if (entry.fileName() == "." || entry.fileName() == "..") { |
396 continue; | 430 continue; |
397 } | |
398 if (!QFile::copy(entry.absoluteFilePath(), targetPath)) { | |
399 qDebug() << "Failed to copy: " << entry.absoluteFilePath() << " to: " << targetPath; | |
400 showErrorMessage(tr("Failed to copy binaries to temporary location.")); | |
401 mProgress.cancel(); | |
402 return NULL; | |
403 } | 431 } |
404 if (entry.suffix() == "exe") { | 432 if (entry.suffix() == "exe") { |
405 if (!signFile(targetPath)) { | 433 if (!signFile(targetPath)) { |
406 showErrorMessage(tr("Failed to sign binaries with osslsigncode.\n" | 434 showErrorMessage(tr("Failed to sign binaries with osslsigncode.\n" |
407 "Please check that %1 is a valid code signing certificate and that" | 435 "Please check that %1 is a valid code signing certificate and that" |