Mercurial > trustbridge
changeset 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 | d92b1594e974 |
children | 491327689ffc 947a880ec5d3 |
files | ui/createinstallerdialog.cpp |
diffstat | 1 files changed, 34 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/createinstallerdialog.cpp Fri Aug 29 13:10:11 2014 +0200 +++ b/ui/createinstallerdialog.cpp Fri Aug 29 14:28:00 2014 +0200 @@ -383,6 +383,31 @@ return true; } +bool copyPath(QString src, QString dst) +{ + QDir dir(src); + if (! dir.exists()) { + qDebug() << "Source directory does not exist."; + return false; + } + + foreach (QString d, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + QString dst_path = dst + QDir::separator() + d; + dir.mkpath(dst_path); + if (!copyPath(src+ QDir::separator() + d, dst_path)) { + qDebug() << "Failed to copy subdirectory; " << d; + return false; + } + } + + foreach (QString f, dir.entryList(QDir::Files)) { + if (!QFile::copy(src + QDir::separator() + f, dst + QDir::separator() + f)) { + qDebug() << "Failed to copy: " << f; + return false; + } + } + return true; +} QTemporaryDir *CreateInstallerDialog::codesignBinaries(const QDir& sourceDir) { QTemporaryDir* target = new QTemporaryDir(); @@ -390,17 +415,20 @@ mProgress.setLabelText(tr("Signing binaries...")); mProgress.show(); + + /* Copy the whole directory. */ + if (!copyPath(sourceDir.path(), target->path())) { + qDebug() << "Copy failed."; + showErrorMessage(tr("Failed to copy binaries to temporary location.")); + mProgress.cancel(); + return NULL; + } + /* Sign the top level .exe files */ foreach (const QFileInfo& entry, sourceDir.entryInfoList()) { QString targetPath = target->path() + QString::fromLatin1("/") + entry.fileName(); if (entry.fileName() == "." || entry.fileName() == "..") { continue; } - if (!QFile::copy(entry.absoluteFilePath(), targetPath)) { - qDebug() << "Failed to copy: " << entry.absoluteFilePath() << " to: " << targetPath; - showErrorMessage(tr("Failed to copy binaries to temporary location.")); - mProgress.cancel(); - return NULL; - } if (entry.suffix() == "exe") { if (!signFile(targetPath)) { showErrorMessage(tr("Failed to sign binaries with osslsigncode.\n"