From 6782d848c10059d6ddde078dd276e26fd81eab10 Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Mon, 22 Feb 2010 11:03:04 +0100
Subject: [PATCH] GnuPoc: Do create pre-parsed pkg-file.

---
 .../qt-s60/s60devicerunconfiguration.cpp      | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index 2ebe03ef7b4..aa96e574c8e 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -671,12 +671,6 @@ void S60DeviceRunControlBase::start()
         return;
     }
 
-    if (!createPackageFileFromTemplate(&errorMessage)) {
-        error(this, errorMessage);
-        emit finished();
-        return;
-    }
-
     QStringList makeSisArgs;
     switch (m_toolChain) {
     case ProjectExplorer::ToolChain::GCCE_GNUPOC:
@@ -687,6 +681,12 @@ void S60DeviceRunControlBase::start()
                     << (QLatin1String("QT_SIS_KEY=") + signSisKey());
         break;
     default:
+        // ABLD: Create from template, replacing paths
+        if (!createPackageFileFromTemplate(&errorMessage)) {
+            error(this, errorMessage);
+            emit finished();
+            return;
+        }
         makeSisArgs.push_back(m_packageFile);
         break;
     }
@@ -737,29 +737,29 @@ void S60DeviceRunControlBase::readStandardOutput()
     emit addToOutputWindowInline(this, QString::fromLocal8Bit(data.constData(), data.length()));
 }
 
+// ABLD: Create "foo_<platform>_<target>.pkg" and replace variables for the target
+// path pointing into the EPOC directories.
 bool S60DeviceRunControlBase::createPackageFileFromTemplate(QString *errorMessage)
 {
     if (debug)
         qDebug() << "Creating package file" << m_packageFilePath << " from " << m_packageTemplateFile
                 << m_symbianPlatform << m_symbianTarget;
     QFile packageTemplate(m_packageTemplateFile);
-    if (!packageTemplate.open(QIODevice::ReadOnly)) {
+    if (!packageTemplate.open(QIODevice::ReadOnly|QIODevice::Text)) {
         *errorMessage = tr("Could not read template package file '%1'").arg(QDir::toNativeSeparators(m_packageTemplateFile));
         return false;
     }
-    QString contents = packageTemplate.readAll();
+    QString contents = QString::fromLocal8Bit(packageTemplate.readAll());
     packageTemplate.close();
     contents.replace(QLatin1String("$(PLATFORM)"), m_symbianPlatform);
     contents.replace(QLatin1String("$(TARGET)"), m_symbianTarget);
     QFile packageFile(m_packageFilePath);
-    if (!packageFile.open(QIODevice::WriteOnly)) {
+    if (!packageFile.open(QIODevice::WriteOnly|QIODevice::Text)) {
         *errorMessage = tr("Could not write package file '%1'").arg(QDir::toNativeSeparators(m_packageFilePath));
         return false;
     }
     packageFile.write(contents.toLocal8Bit());
     packageFile.close();
-    if (debug > 1)
-        qDebug() << contents;
     return true;
 }
 
-- 
GitLab