forked from qt-creator/qt-creator
Use Utils::FileName in abi
Use FileName when passing in a file to extract ABIs from. Also convert some helper functions in baseqtversion to use FileNames in favor of normal strings. Change-Id: I41c724c4c05bb4ff0d8b832f84fffa08d64762d9 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -458,7 +458,7 @@ static QToolButton *toolButton(QAction *action)
|
||||
|
||||
static Abi anyAbiOfBinary(const QString &fileName)
|
||||
{
|
||||
QList<Abi> abis = Abi::abisOfBinary(fileName);
|
||||
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(fileName));
|
||||
if (abis.isEmpty())
|
||||
return Abi();
|
||||
return abis.at(0);
|
||||
@@ -1726,7 +1726,7 @@ void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
|
||||
return;
|
||||
}
|
||||
|
||||
QList<Abi> abis = Abi::abisOfBinary(localExecutable);
|
||||
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(localExecutable));
|
||||
if (abis.isEmpty()) {
|
||||
QMessageBox::warning(mainWindow(), tr("Warning"),
|
||||
tr("Cannot find ABI for remote process \"%1\".")
|
||||
|
||||
@@ -731,7 +731,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
|
||||
sp.processArgs = rc->commandLineArguments();
|
||||
sp.toolChainAbi = rc->abi();
|
||||
if (!sp.toolChainAbi.isValid()) {
|
||||
QList<Abi> abis = Abi::abisOfBinary(sp.executable);
|
||||
QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(sp.executable));
|
||||
if (!abis.isEmpty())
|
||||
sp.toolChainAbi = abis.at(0);
|
||||
}
|
||||
|
||||
@@ -669,13 +669,13 @@ Abi Abi::hostAbi()
|
||||
return Abi(arch, os, subos, format, QSysInfo::WordSize);
|
||||
}
|
||||
|
||||
QList<Abi> Abi::abisOfBinary(const QString &path)
|
||||
QList<Abi> Abi::abisOfBinary(const Utils::FileName &path)
|
||||
{
|
||||
QList<Abi> tmp;
|
||||
if (path.isEmpty())
|
||||
return tmp;
|
||||
|
||||
QFile f(path);
|
||||
QFile f(path.toString());
|
||||
if (!f.exists())
|
||||
return tmp;
|
||||
|
||||
@@ -692,7 +692,7 @@ QList<Abi> Abi::abisOfBinary(const QString &path)
|
||||
|
||||
while (!data.isEmpty()) {
|
||||
if ((getUint8(data, 58) != 0x60 || getUint8(data, 59) != 0x0a)) {
|
||||
qWarning() << path << ": Thought it was an ar-file, but it is not!";
|
||||
qWarning() << path.toString() << ": Thought it was an ar-file, but it is not!";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -857,7 +857,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
|
||||
QFETCH(QString, file);
|
||||
QFETCH(QStringList, abis);
|
||||
|
||||
QList<ProjectExplorer::Abi> result = Abi::abisOfBinary(file);
|
||||
QList<ProjectExplorer::Abi> result = Abi::abisOfBinary(Utils::FileName::fromString(file));
|
||||
QCOMPARE(result.count(), abis.count());
|
||||
for (int i = 0; i < abis.count(); ++i)
|
||||
QCOMPARE(result.at(i).toString(), abis.at(i));
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include "projectexplorer_export.h"
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QtCore/QList>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
@@ -140,7 +142,7 @@ public:
|
||||
static QList<OSFlavor> flavorsForOs(const OS &o);
|
||||
|
||||
static Abi hostAbi();
|
||||
static QList<Abi> abisOfBinary(const QString &path);
|
||||
static QList<Abi> abisOfBinary(const Utils::FileName &path);
|
||||
|
||||
private:
|
||||
Architecture m_architecture;
|
||||
|
||||
@@ -411,7 +411,7 @@ Utils::FileName GccToolChain::mkspec() const
|
||||
return Utils::FileName::fromString(QLatin1String("macx-g++"));
|
||||
}
|
||||
|
||||
QList<Abi> gccAbiList = Abi::abisOfBinary(m_compilerPath);
|
||||
QList<Abi> gccAbiList = Abi::abisOfBinary(Utils::FileName::fromString(m_compilerPath));
|
||||
Abi gccAbi;
|
||||
if (!gccAbiList.isEmpty())
|
||||
gccAbi = gccAbiList.first();
|
||||
|
||||
@@ -633,7 +633,7 @@ QPair<QString, QString> MsvcToolChain::autoDetectCdbDebugger()
|
||||
}
|
||||
|
||||
foreach (const QString &cdb, cdbs) {
|
||||
QList<ProjectExplorer::Abi> abis = ProjectExplorer::Abi::abisOfBinary(cdb);
|
||||
QList<ProjectExplorer::Abi> abis = ProjectExplorer::Abi::abisOfBinary(Utils::FileName::fromString(cdb));
|
||||
if (abis.isEmpty())
|
||||
continue;
|
||||
if (abis.first().wordWidth() == 32)
|
||||
|
||||
@@ -1179,7 +1179,7 @@ Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QStrin
|
||||
return mkspecFullPath;
|
||||
}
|
||||
|
||||
QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
|
||||
Utils::FileName BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString)
|
||||
{
|
||||
QStringList dirs;
|
||||
dirs << versionInfo.value(QLatin1String("QT_INSTALL_LIBS"))
|
||||
@@ -1197,8 +1197,9 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con
|
||||
&& file.startsWith(QLatin1String("QtCore"))
|
||||
&& file.endsWith(QLatin1String(".framework"))) {
|
||||
// handle Framework
|
||||
const QString libName = file.left(file.lastIndexOf(QLatin1Char('.')));
|
||||
return info.absoluteFilePath() + QLatin1Char('/') + libName;
|
||||
Utils::FileName lib(info);
|
||||
lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.'))));
|
||||
return lib;
|
||||
}
|
||||
if (info.isReadable()) {
|
||||
if (file.startsWith(QLatin1String("libQtCore"))
|
||||
@@ -1209,18 +1210,18 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con
|
||||
else if (file.endsWith(QLatin1String(".dll"))
|
||||
|| file.endsWith(QString::fromLatin1(".so.") + versionString)
|
||||
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
|
||||
return info.absoluteFilePath();
|
||||
return Utils::FileName(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return path to first static library found:
|
||||
if (!staticLibs.isEmpty())
|
||||
return staticLibs.at(0).absoluteFilePath();
|
||||
return QString();
|
||||
return Utils::FileName(staticLibs.at(0));
|
||||
return Utils::FileName();
|
||||
}
|
||||
|
||||
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const QString &coreLibrary)
|
||||
QList<ProjectExplorer::Abi> BaseQtVersion::qtAbisFromLibrary(const Utils::FileName &coreLibrary)
|
||||
{
|
||||
return ProjectExplorer::Abi::abisOfBinary(coreLibrary);
|
||||
}
|
||||
|
||||
@@ -221,8 +221,8 @@ protected:
|
||||
virtual QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir);
|
||||
|
||||
// helper function for desktop and simulator to figure out the supported abis based on the libraries
|
||||
static QString qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString);
|
||||
static QList<ProjectExplorer::Abi> qtAbisFromLibrary(const QString &coreLibrary);
|
||||
static Utils::FileName qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString);
|
||||
static QList<ProjectExplorer::Abi> qtAbisFromLibrary(const Utils::FileName &coreLibrary);
|
||||
|
||||
void ensureMkSpecParsed() const;
|
||||
virtual void parseMkSpec(ProFileEvaluator *) const;
|
||||
|
||||
Reference in New Issue
Block a user