Commit aaae1420 authored by Alessandro Portale's avatar Alessandro Portale
Browse files

Implemented updateFiles()

parent 49a650fb
......@@ -648,5 +648,22 @@ QList<GeneratedFileInfo> QmlStandaloneApp::fileUpdates(const QString &mainProFil
return result;
}
bool QmlStandaloneApp::updateFiles(const QList<GeneratedFileInfo> &list, QString &error)
{
error.clear();
const QmlStandaloneApp app;
foreach (const GeneratedFileInfo &info, list) {
const QByteArray data = app.generateFile(info.file, &error);
if (!error.isEmpty())
return false;
QFile file(info.fileInfo.absoluteFilePath());
if (!file.open(QIODevice::WriteOnly) || file.write(data) == -1) {
error = tr("Could not write file '%1'.").arg(QDir::toNativeSeparators(info.fileInfo.canonicalFilePath()));
return false;
}
}
return true;
}
} // namespace Internal
} // namespace Qt4ProjectManager
......@@ -170,6 +170,7 @@ public:
QByteArray generateFile(GeneratedFileInfo::File file, const QString *errorMessage) const;
static int stubVersion();
static QList<GeneratedFileInfo> fileUpdates(const QString &mainProFile);
static bool updateFiles(const QList<GeneratedFileInfo> &list, QString &error);
private:
QByteArray generateMainCpp(const QString *errorMessage) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment