diff options
Diffstat (limited to 'src/libs/installer/createlocalrepositoryoperation.cpp')
-rw-r--r-- | src/libs/installer/createlocalrepositoryoperation.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/libs/installer/createlocalrepositoryoperation.cpp b/src/libs/installer/createlocalrepositoryoperation.cpp index 87db3a472..e74536b0c 100644 --- a/src/libs/installer/createlocalrepositoryoperation.cpp +++ b/src/libs/installer/createlocalrepositoryoperation.cpp @@ -153,15 +153,20 @@ bool CreateLocalRepositoryOperation::performOperation() return false; } - QString repoPath; try { - QString binaryPath = QFileInfo(args.at(0)).absoluteFilePath(); + const QString binaryPath = QFileInfo(args.at(0)).absoluteFilePath(); // Note the "/" at the end, important to make copy directory operation behave well - repoPath = QFileInfo(args.at(1)).absoluteFilePath() + QLatin1String("/repository/"); + const QString repoPath = QFileInfo(args.at(1)).absoluteFilePath() + QLatin1Char('/'); - // if we're running as installer and install into an existing target, remove possible previous repos + // check if this is an offline version, otherwise there will be no binary data PackageManagerCore *core = qVariantValue<PackageManagerCore*>(value(QLatin1String("installer"))); - if (core && core->isOfflineOnly() && QFile::exists(repoPath)) { + if (core && !core->isOfflineOnly()) { + throw QInstaller::Error(tr("Installer needs to be an offline version: %1.") + .arg(QDir::toNativeSeparators(binaryPath))); + } + + // if we're running as installer and install into an existing target, remove possible previous repos + if (QFile::exists(repoPath)) { Static::fixPermissions(repoPath); QInstaller::removeDirectory(repoPath); } |