[PATCH] Copy the windows files recursively into the temporary directory
Wald Commits
scm-commit at wald.intevation.org
Fri Aug 29 14:28:21 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1409315280 -7200
# Node ID 01128d63226d23dd36fc7f27d4d794411f14cc45
# Parent d92b1594e974babb7dafdccb077a2f196403919b
Copy the windows files recursively into the temporary directory
diff -r d92b1594e974 -r 01128d63226d ui/createinstallerdialog.cpp
--- 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"
More information about the Trustbridge-commits
mailing list