createOperationsForArchive should use the correct path

- only with this you are able to overload the createOperationsForArchive without the knowledge where the archive comes from

Change-Id: Ica65c2bbd14cf554ab4702f5886d74423bbc86f5
Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
This commit is contained in:
Tim Jenssen 2012-04-13 14:21:50 +02:00
parent e6b89ee2dd
commit aeaf1b8455

View File

@ -593,14 +593,13 @@ void Component::createOperationsForArchive(const QString &archive)
if (callScriptMethod(QLatin1String("createOperationsForArchive"), QScriptValueList() << archive).isValid()) if (callScriptMethod(QLatin1String("createOperationsForArchive"), QScriptValueList() << archive).isValid())
return; return;
const QFileInfo fi(QString::fromLatin1("installer://%1/%2").arg(name(), archive)); const bool isZip = Lib7z::isSupportedArchive(archive);
const bool isZip = Lib7z::isSupportedArchive(fi.filePath());
if (isZip) { if (isZip) {
// archives get completely extracted per default (if the script isn't doing other stuff) // archives get completely extracted per default (if the script isn't doing other stuff)
addOperation(QLatin1String("Extract"), fi.filePath(), QLatin1String("@TargetDir@")); addOperation(QLatin1String("Extract"), archive, QLatin1String("@TargetDir@"));
} else { } else {
createOperationsForPath(fi.filePath()); createOperationsForPath(archive);
} }
} }
@ -612,7 +611,6 @@ void Component::beginInstallation()
} }
} }
/*! /*!
Creates all operations needed to install this component. Creates all operations needed to install this component.
You can override this method by providing a method with the same name in the component script. You can override this method by providing a method with the same name in the component script.
@ -655,12 +653,16 @@ QList<QPair<QString, bool> > Component::pathesForUninstallation() const
} }
/*! /*!
Contains the names of all archives known to this component. This does not contain archives added Contains the names of all archives known to this component. Even downloaded archives are mapped
with #addDownloadableArchive. to the installer:// url throw the used QFileEngineHandler during the download process.
*/ */
QStringList Component::archives() const QStringList Component::archives() const
{ {
return QDir(QString::fromLatin1("installer://%1/").arg(name())).entryList(); QString pathString = QString::fromLatin1("installer://%1/").arg(name());
QStringList archivesNameList = QDir(pathString).entryList();
//RegExp "^" means line beginning
archivesNameList.replaceInStrings(QRegExp(QLatin1String("^")), pathString);
return archivesNameList;
} }
/*! /*!