AutoTest: Use Utils::FilePath for files and directories

Still some missing bits as some QString members had different meanings
depending on their context.

Change-Id: Ib48eab54498974a26bbd5123cbffeefee5f7e79c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Stenger
2021-05-26 15:50:03 +02:00
parent e8286088b1
commit 5525f2b112
70 changed files with 376 additions and 371 deletions

View File

@@ -36,7 +36,7 @@ CppParser::CppParser(ITestFramework *framework)
{
}
void CppParser::init(const QStringList &filesToParse, bool fullParse)
void CppParser::init(const Utils::FilePaths &filesToParse, bool fullParse)
{
Q_UNUSED(filesToParse)
Q_UNUSED(fullParse)
@@ -44,7 +44,7 @@ void CppParser::init(const QStringList &filesToParse, bool fullParse)
m_workingCopy = CppTools::CppModelManager::instance()->workingCopy();
}
bool CppParser::selectedForBuilding(const QString &fileName)
bool CppParser::selectedForBuilding(const Utils::FilePath &fileName)
{
QList<CppTools::ProjectPart::Ptr> projParts =
CppTools::CppModelManager::instance()->projectPart(fileName);
@@ -52,7 +52,7 @@ bool CppParser::selectedForBuilding(const QString &fileName)
return !projParts.isEmpty() && projParts.at(0)->selectedForBuilding;
}
QByteArray CppParser::getFileContent(const QString &filePath) const
QByteArray CppParser::getFileContent(const Utils::FilePath &filePath) const
{
QByteArray fileContent;
if (m_workingCopy.contains(filePath)) {
@@ -60,11 +60,8 @@ QByteArray CppParser::getFileContent(const QString &filePath) const
} else {
QString error;
const QTextCodec *codec = Core::EditorManager::defaultTextCodec();
if (Utils::TextFileFormat::readFileUTF8(Utils::FilePath::fromString(filePath),
codec,
&fileContent,
&error)
!= Utils::TextFileFormat::ReadSuccess) {
if (Utils::TextFileFormat::readFileUTF8(filePath, codec, &fileContent, &error)
!= Utils::TextFileFormat::ReadSuccess) {
qDebug() << "Failed to read file" << filePath << ":" << error;
}
}
@@ -78,7 +75,7 @@ void CppParser::release()
m_workingCopy = CppTools::WorkingCopy();
}
CPlusPlus::Document::Ptr CppParser::document(const QString &fileName)
CPlusPlus::Document::Ptr CppParser::document(const Utils::FilePath &fileName)
{
return selectedForBuilding(fileName) ? m_cppSnapshot.document(fileName) : nullptr;
}