summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaurice Kalinowski <maurice.kalinowski@nokia.com>2011-03-23 08:57:41 +0100
committerMaurice Kalinowski <maurice.kalinowski@nokia.com>2011-03-23 08:57:41 +0100
commit225a8518e19aa92925d4e832f1ea253b21fcb90f (patch)
tree27a424d5fdf6df9b89c5d4a9b9b34d11b7b5d43f
parent7af5c171f9af06aa9c51d77fa37f62a8573e3015 (diff)
make configuration file name dynamic
This allows to have multiple installations into the same directory, in case TargetConfigurationFile is set to different names. Still defaults back to components.xml Reviewed-by: Niels Weber
-rw-r--r--installerbuilder/common/installersettings.cpp6
-rw-r--r--installerbuilder/common/installersettings.h2
-rw-r--r--installerbuilder/libinstaller/qinstaller.cpp14
3 files changed, 18 insertions, 4 deletions
diff --git a/installerbuilder/common/installersettings.cpp b/installerbuilder/common/installersettings.cpp
index c1bfab728..7f104c4f6 100644
--- a/installerbuilder/common/installersettings.cpp
+++ b/installerbuilder/common/installersettings.cpp
@@ -70,6 +70,7 @@ public:
QString icon;
QString uninstallerName;
QString uninstallerIniFile;
+ QString configurationFileName;
QList<Repository> repositories;
QStringList certificateFiles;
QByteArray privateKey;
@@ -166,6 +167,7 @@ InstallerSettings InstallerSettings::fromFileAndPrefix( const QString& path, con
s.d->uninstallerIniFile = readChild( root, QLatin1String("UninstallerIniFile"), s.d->uninstallerName + QLatin1String(".ini") );
s.d->privateKey = splitTrimmed( readChild( root, QLatin1String( "PrivateKey" ) ) ).toLatin1();
s.d->publicKey = splitTrimmed( readChild( root, QLatin1String( "PublicKey" ) ) ).toLatin1();
+ s.d->configurationFileName = readChild( root, QLatin1String( "TargetConfigurationFile"), QLatin1String("components.xml"));
const QDomNodeList reposTags = root.elementsByTagName( QLatin1String("RemoteRepositories") );
if ( reposTags.size() > 1 )
@@ -287,6 +289,10 @@ QString InstallerSettings::adminTargetDir() const {
return d->adminTargetDir;
}
+QString InstallerSettings::configurationFileName() const {
+ return d->configurationFileName;
+}
+
QList<Repository> InstallerSettings::repositories() const {
return d->repositories;
}
diff --git a/installerbuilder/common/installersettings.h b/installerbuilder/common/installersettings.h
index 342d8fcd4..d73049345 100644
--- a/installerbuilder/common/installersettings.h
+++ b/installerbuilder/common/installersettings.h
@@ -76,6 +76,8 @@ namespace QInstaller {
QByteArray privateKey() const;
QByteArray publicKey() const;
+ QString configurationFileName() const;
+
QList<Repository> repositories() const;
void setTemporaryRepositories(const QList<Repository> &repos, bool replace);
diff --git a/installerbuilder/libinstaller/qinstaller.cpp b/installerbuilder/libinstaller/qinstaller.cpp
index c129e410b..aaf094e3c 100644
--- a/installerbuilder/libinstaller/qinstaller.cpp
+++ b/installerbuilder/libinstaller/qinstaller.cpp
@@ -387,10 +387,15 @@ public:
void writeUninstaller(QVector<KDUpdater::UpdateOperation*> performedOperations);
QString targetDir() const { return q->value(QLatin1String("TargetDir")); }
+ QString configurationFileName() const {
+ return q->value(QLatin1String("TargetConfigurationFile"),
+ QString::fromLatin1("components.xml"));
+ }
+
QString componentsXmlPath() const
{
return QDir::toNativeSeparators(QDir(QDir::cleanPath(targetDir()))
- .absoluteFilePath(QLatin1String("components.xml")));
+ .absoluteFilePath(configurationFileName()));
}
QString localComponentsXmlPath() const
@@ -398,7 +403,7 @@ public:
const QString &appDirPath = QCoreApplication::applicationDirPath();
if (QFileInfo(appDirPath + QLatin1String("/../..")).isBundle()) {
return QDir::toNativeSeparators(QFileInfo(QDir::cleanPath(appDirPath
- + QLatin1String("/../../../components.xml"))).absoluteFilePath());
+ + QLatin1String("/../../../") + configurationFileName())).absoluteFilePath());
}
return componentsXmlPath();
}
@@ -621,6 +626,7 @@ void Installer::Private::initialize()
m_vars.insert(QLatin1String("LogoSmallPixmap"), m_settings.logoSmall());
m_vars.insert(QLatin1String("WatermarkPixmap"), m_settings.watermark());
+ m_vars.insert(QLatin1String("TargetConfigurationFile"), m_settings.configurationFileName());
m_vars.insert(QLatin1String("RunProgram"), replaceVariables(m_settings.runProgram()));
const QString desc = m_settings.runProgramDescription();
if (!desc.isEmpty())
@@ -1808,14 +1814,14 @@ void Installer::Private::deleteUninstaller()
if (QFileInfo(QFileInfo(installerBinaryPath() + cdUp).absoluteFilePath()).isBundle()) {
removeDirectoryThreaded(QFileInfo(installerBinaryPath() + cdUp).absoluteFilePath());
QFile::remove(QFileInfo(installerBinaryPath() + cdUp).absolutePath()
- + QLatin1String("/components.xml"));
+ + QLatin1String("/") + configurationFileName());
}
else
#endif
#endif
{
// finally remove the components.xml, since it still exists now
- QFile::remove(QFileInfo(installerBinaryPath()).absolutePath() + QLatin1String("/components.xml"));
+ QFile::remove(QFileInfo(installerBinaryPath()).absolutePath() + QLatin1String("/") + configurationFileName());
}
}