QmlProjectExporter: Use native line endings and spaces instead of tab

Fixes: QDS-13648
Change-Id: I1822a31047f119e649062f341ab7dd1fc0415331
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2024-09-17 12:19:07 +02:00
committed by Thomas Hartmann
parent a85aa46833
commit 395f1335a0

View File

@@ -44,7 +44,7 @@ CMakeWriter::Ptr CMakeWriter::create(CMakeGenerator *parent)
QString CMakeWriter::readTemplate(const QString &templatePath) QString CMakeWriter::readTemplate(const QString &templatePath)
{ {
QFile templatefile(templatePath); QFile templatefile(templatePath);
templatefile.open(QIODevice::ReadOnly); templatefile.open(QIODevice::ReadOnly | QIODevice::Text);
QTextStream stream(&templatefile); QTextStream stream(&templatefile);
QString content = stream.readAll(); QString content = stream.readAll();
templatefile.close(); templatefile.close();
@@ -54,9 +54,12 @@ QString CMakeWriter::readTemplate(const QString &templatePath)
void CMakeWriter::writeFile(const Utils::FilePath &path, const QString &content) void CMakeWriter::writeFile(const Utils::FilePath &path, const QString &content)
{ {
QFile fileHandle(path.toString()); 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); QTextStream stream(&fileHandle);
stream << content; stream << cpy;
} else { } else {
QString text("Failed to write"); QString text("Failed to write");
CMakeGenerator::logIssue(ProjectExplorer::Task::Error, text, path); CMakeGenerator::logIssue(ProjectExplorer::Task::Error, text, path);