forked from qt-creator/qt-creator
Utils: Fix line ending conversion in FileReader
FilePath::fileContents always uses "binary" mode when reading files. FileReader::fetch previously used QFile with QIODevice::Text mode to read (local) files, which converts \r\n to \n. This patch re-introduces the conversion. Fixes: QTCREATORBUG-29040 Change-Id: I0a16b056bea456512e6526497b725c73b0a1bd11 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -62,6 +62,10 @@ bool FileReader::fetch(const FilePath &filePath, QIODevice::OpenMode mode)
|
||||
return false;
|
||||
}
|
||||
m_data = *contents;
|
||||
|
||||
if (mode & QIODevice::Text)
|
||||
m_data = m_data.replace("\r\n", "\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user