From 8da57f37320478e1ae6094410ff230aa4580689b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 24 Apr 2012 19:14:10 +0200 Subject: [PATCH] Make configure.exe create files with Windows line-endings Except for the perl sources, just in case. This helps if you need to open the output files in, say, notepad.exe. Change-Id: Ibf46b74af2efd6936586650e1405750bfef17952 Reviewed-by: Oswald Buddenhagen --- tools/configure/configureapp.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 27b4fabf09..7151f3e119 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -80,7 +80,7 @@ bool writeToFile(const char* text, const QString &filename) QDir dir(QFileInfo(file).absoluteDir()); if (!dir.exists()) dir.mkpath(dir.absolutePath()); - if (!file.open(QFile::WriteOnly)) { + if (!file.open(QFile::WriteOnly | QFile::Text)) { cout << "Couldn't write to " << qPrintable(filename) << ": " << qPrintable(file.errorString()) << endl; return false; @@ -144,13 +144,14 @@ Configure::Configure(int& argc, char** argv) { //make a syncqt script(s) that can be used in the shadow QFile syncqt(buildPath + "/bin/syncqt"); + // no QFile::Text, just in case the perl interpreter can't cope with them (unlikely) if (syncqt.open(QFile::WriteOnly)) { QTextStream stream(&syncqt); stream << "#!/usr/bin/perl -w" << endl << "require \"" << sourcePath + "/bin/syncqt\";" << endl; } QFile syncqt_bat(buildPath + "/bin/syncqt.bat"); - if (syncqt_bat.open(QFile::WriteOnly)) { + if (syncqt_bat.open(QFile::WriteOnly | QFile::Text)) { QTextStream stream(&syncqt_bat); stream << "@echo off" << endl << "call " << fixSeparators(sourcePath) << fixSeparators("/bin/syncqt.bat -qtdir \"") << fixSeparators(buildPath) << "\" %*" << endl; @@ -159,6 +160,7 @@ Configure::Configure(int& argc, char** argv) } QFile configtests(buildPath + "/bin/qtmodule-configtests"); + // no QFile::Text, just in case the perl interpreter can't cope with them (unlikely) if (configtests.open(QFile::WriteOnly)) { QTextStream stream(&configtests); stream << "#!/usr/bin/perl -w" << endl @@ -3425,7 +3427,7 @@ void Configure::generateMakefiles() QDir::setCurrent(fixSeparators(dirPath)); QFile file(makefileName); - if (!file.open(QFile::WriteOnly)) { + if (!file.open(QFile::WriteOnly | QFile::Text)) { printf("failed on dirPath=%s, makefile=%s\n", qPrintable(dirPath), qPrintable(makefileName)); continue;