forked from qt-creator/qt-creator
QbsPM: Avoid QFileInfo for paths that may non-local
Change-Id: I08b0b2c298c8f175e0c0a2d5e87691354afa46e5 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -313,22 +313,20 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
if (tcCxx)
|
||||
cxxCompilerPath = tcCxx->compilerCommand();
|
||||
|
||||
const QFileInfo cFileInfo = cCompilerPath.toFileInfo();
|
||||
const QFileInfo cxxFileInfo = cxxCompilerPath.toFileInfo();
|
||||
QString cCompilerName = cFileInfo.fileName();
|
||||
QString cxxCompilerName = cxxFileInfo.fileName();
|
||||
QString cCompilerName = cCompilerPath.fileName();
|
||||
QString cxxCompilerName = cxxCompilerPath.fileName();
|
||||
const QString cToolchainPrefix = extractToolchainPrefix(&cCompilerName);
|
||||
const QString cxxToolchainPrefix = extractToolchainPrefix(&cxxCompilerName);
|
||||
|
||||
QFileInfo mainFileInfo;
|
||||
Utils::FilePath mainFilePath;
|
||||
QString mainCompilerName;
|
||||
QString mainToolchainPrefix;
|
||||
if (tcCxx) {
|
||||
mainFileInfo = cxxFileInfo;
|
||||
mainFilePath = cxxCompilerPath;
|
||||
mainCompilerName = cxxCompilerName;
|
||||
mainToolchainPrefix = cxxToolchainPrefix;
|
||||
} else {
|
||||
mainFileInfo = cFileInfo;
|
||||
mainFilePath = cCompilerPath;
|
||||
mainCompilerName = cCompilerName;
|
||||
mainToolchainPrefix = cToolchainPrefix;
|
||||
}
|
||||
@@ -353,11 +351,11 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
}
|
||||
|
||||
if (tcC && tcCxx && !cCompilerPath.isEmpty() && !cxxCompilerPath.isEmpty()
|
||||
&& cFileInfo.absolutePath() != cxxFileInfo.absolutePath()) {
|
||||
&& cCompilerPath.absolutePath() != cxxCompilerPath.absolutePath()) {
|
||||
Core::MessageManager::writeFlashing(
|
||||
tr("C and C++ compiler paths differ. C compiler may not work."));
|
||||
}
|
||||
data.insert(QLatin1String(CPP_TOOLCHAINPATH), mainFileInfo.absolutePath());
|
||||
data.insert(QLatin1String(CPP_TOOLCHAINPATH), mainFilePath.absolutePath().toString());
|
||||
|
||||
if (auto gcc = dynamic_cast<ProjectExplorer::GccToolChain *>(mainTc)) {
|
||||
QStringList compilerFlags = gcc->platformCodeGenFlags();
|
||||
@@ -372,7 +370,7 @@ QVariantMap DefaultPropertyProvider::autoGeneratedProperties(const ProjectExplor
|
||||
// Reverse engineer the Xcode developer path from the compiler path
|
||||
const QRegularExpression compilerRe(
|
||||
QStringLiteral("^(?<developerpath>.*)/Toolchains/(?:.+)\\.xctoolchain/usr/bin$"));
|
||||
const QRegularExpressionMatch compilerReMatch = compilerRe.match(cxxFileInfo.absolutePath());
|
||||
const QRegularExpressionMatch compilerReMatch = compilerRe.match(cxxCompilerPath.absolutePath().toString());
|
||||
if (compilerReMatch.hasMatch()) {
|
||||
const QString developerPath = compilerReMatch.captured(QStringLiteral("developerpath"));
|
||||
data.insert(QLatin1String(XCODE_DEVELOPERPATH), developerPath);
|
||||
|
Reference in New Issue
Block a user