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 ca3b41acb4
commit facc504c7f

View File

@@ -51,7 +51,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();
@@ -61,9 +61,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);