Commit 6b5bccd0 authored by raidsan's avatar raidsan Committed by Eike Ziller

"Find Usages" and "Refactor" may decode error.

Task-number: QTCREATORBUG-7204

Change-Id: I6ce82c701246ddac9cadcdd22ef994b0086ce8f7
Reviewed-by: default avatarAndre Hartmann <aha_1980@gmx.de>
Reviewed-by: default avatarEike Ziller <eike.ziller@digia.com>
parent 9de676ce
......@@ -65,6 +65,7 @@
#include <QDir>
#include <QApplication>
#include <utils/runextensions.h>
#include <utils/textfileformat.h>
#include <functional>
......@@ -77,11 +78,16 @@ static QString getSource(const QString &fileName,
if (workingCopy.contains(fileName)) {
return workingCopy.source(fileName);
} else {
Utils::FileReader reader;
if (!reader.fetch(fileName, QFile::Text)) // ### FIXME error reporting
return QString();
return QString::fromLocal8Bit(reader.data()); // ### FIXME encoding
QString fileContents;
Utils::TextFileFormat format;
QString error;
QTextCodec *defaultCodec = Core::EditorManager::instance()->defaultTextCodec();
Utils::TextFileFormat::ReadResult result = Utils::TextFileFormat::readFile(
fileName, defaultCodec, &fileContents, &format, &error);
if (result != Utils::TextFileFormat::ReadSuccess)
qWarning() << "Could not read " << fileName << ". Error: " << error;
return fileContents;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment