From 3a81ca00f31e17d6995a84a4adf261c80c1d8ba7 Mon Sep 17 00:00:00 2001 From: kh1 Date: Fri, 22 Mar 2013 15:01:32 +0100 Subject: Small cleanup, no functional change. Change-Id: I339d99d86ab71af785a9fa7b221d255d0e1f1f9b Reviewed-by: Niels Weber --- tools/common/repositorygen.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'tools') diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp index fdad96871..1f1a169d0 100644 --- a/tools/common/repositorygen.cpp +++ b/tools/common/repositorygen.cpp @@ -75,26 +75,21 @@ void QInstallerTools::printRepositoryGenOptions() void QInstallerTools::copyWithException(const QString &source, const QString &target, const QString &kind) { - QFile sourceFile(source); qDebug() << QString::fromLatin1("Copying associated %1 file '%2'").arg(kind, source); const QFileInfo targetFileInfo(target); - const QDir targetDir = targetFileInfo.dir(); - if (!targetDir.exists()) + if (!targetFileInfo.dir().exists()) QInstaller::mkpath(targetFileInfo.absolutePath()); - // in the case of an existing target the error String does not show the file - if (targetFileInfo.exists()) { - qDebug() << "failed!\n"; - throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file from\n'%2' to '%3'\nError: '%4'." - ).arg(kind, source, target, QLatin1String("Target already exist."))); - } - + QFile sourceFile(source); if (!sourceFile.copy(target)) { qDebug() << "failed!\n"; - throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file.\nError: '%2'" - ).arg(kind, sourceFile.errorString())); + throw QInstaller::Error(QString::fromLatin1("Could not copy the %1 file from\n'%2' to '%3'\nError: " + "'%4'.").arg(kind, source, target, + /* in case of an existing target the error String does not show the file */ + (targetFileInfo.exists() ? QLatin1String("Target already exist.") : sourceFile.errorString()))); } + qDebug() << "done.\n"; } -- cgit v1.2.3