From 395f1335a05c3ebde38d9abf95bcc1df2fb6637a Mon Sep 17 00:00:00 2001 From: Knud Dollereder Date: Tue, 17 Sep 2024 12:19:07 +0200 Subject: [PATCH] QmlProjectExporter: Use native line endings and spaces instead of tab Fixes: QDS-13648 Change-Id: I1822a31047f119e649062f341ab7dd1fc0415331 Reviewed-by: Thomas Hartmann --- .../qmlprojectmanager/qmlprojectexporter/cmakewriter.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmlprojectmanager/qmlprojectexporter/cmakewriter.cpp b/src/plugins/qmlprojectmanager/qmlprojectexporter/cmakewriter.cpp index 966714981a0..206029a125b 100644 --- a/src/plugins/qmlprojectmanager/qmlprojectexporter/cmakewriter.cpp +++ b/src/plugins/qmlprojectmanager/qmlprojectexporter/cmakewriter.cpp @@ -44,7 +44,7 @@ CMakeWriter::Ptr CMakeWriter::create(CMakeGenerator *parent) QString CMakeWriter::readTemplate(const QString &templatePath) { QFile templatefile(templatePath); - templatefile.open(QIODevice::ReadOnly); + templatefile.open(QIODevice::ReadOnly | QIODevice::Text); QTextStream stream(&templatefile); QString content = stream.readAll(); templatefile.close(); @@ -54,9 +54,12 @@ QString CMakeWriter::readTemplate(const QString &templatePath) void CMakeWriter::writeFile(const Utils::FilePath &path, const QString &content) { QFile fileHandle(path.toString()); - if (fileHandle.open(QIODevice::WriteOnly)) { + if (fileHandle.open(QIODevice::WriteOnly | QIODevice::Text)) { + QString cpy = content; + cpy.replace("\t", " "); + QTextStream stream(&fileHandle); - stream << content; + stream << cpy; } else { QString text("Failed to write"); CMakeGenerator::logIssue(ProjectExplorer::Task::Error, text, path);