Commit 664fb633 authored by Tobias Hunger's avatar Tobias Hunger

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: default avatarDaniel Teske <daniel.teske@nokia.com>
parent daac0787
...@@ -458,7 +458,7 @@ static QToolButton *toolButton(QAction *action) ...@@ -458,7 +458,7 @@ static QToolButton *toolButton(QAction *action)
static Abi anyAbiOfBinary(const QString &fileName) static Abi anyAbiOfBinary(const QString &fileName)
{ {
QList<Abi> abis = Abi::abisOfBinary(fileName); QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(fileName));
if (abis.isEmpty()) if (abis.isEmpty())
return Abi(); return Abi();
return abis.at(0); return abis.at(0);
...@@ -1726,7 +1726,7 @@ void DebuggerPluginPrivate::gdbServerStarted(const QString &channel, ...@@ -1726,7 +1726,7 @@ void DebuggerPluginPrivate::gdbServerStarted(const QString &channel,
return; return;
} }
QList<Abi> abis = Abi::abisOfBinary(localExecutable); QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(localExecutable));
if (abis.isEmpty()) { if (abis.isEmpty()) {
QMessageBox::warning(mainWindow(), tr("Warning"), QMessageBox::warning(mainWindow(), tr("Warning"),
tr("Cannot find ABI for remote process \"%1\".") tr("Cannot find ABI for remote process \"%1\".")
......
...@@ -731,7 +731,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu ...@@ -731,7 +731,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.processArgs = rc->commandLineArguments(); sp.processArgs = rc->commandLineArguments();
sp.toolChainAbi = rc->abi(); sp.toolChainAbi = rc->abi();
if (!sp.toolChainAbi.isValid()) { if (!sp.toolChainAbi.isValid()) {
QList<Abi> abis = Abi::abisOfBinary(sp.executable); QList<Abi> abis = Abi::abisOfBinary(Utils::FileName::fromString(sp.executable));
if (!abis.isEmpty()) if (!abis.isEmpty())
sp.toolChainAbi = abis.at(0); sp.toolChainAbi = abis.at(0);
} }
......
...@@ -669,13 +669,13 @@ Abi Abi::hostAbi() ...@@ -669,13 +669,13 @@ Abi Abi::hostAbi()
return Abi(arch, os, subos, format, QSysInfo::WordSize); 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; QList<Abi> tmp;
if (path.isEmpty()) if (path.isEmpty())
return tmp; return tmp;
QFile f(path); QFile f(path.toString());
if (!f.exists()) if (!f.exists())
return tmp; return tmp;
...@@ -692,7 +692,7 @@ QList<Abi> Abi::abisOfBinary(const QString &path) ...@@ -692,7 +692,7 @@ QList<Abi> Abi::abisOfBinary(const QString &path)
while (!data.isEmpty()) { while (!data.isEmpty()) {
if ((getUint8(data, 58) != 0x60 || getUint8(data, 59) != 0x0a)) { 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; break;
} }
...@@ -857,7 +857,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary() ...@@ -857,7 +857,7 @@ void ProjectExplorer::ProjectExplorerPlugin::testAbiOfBinary()
QFETCH(QString, file); QFETCH(QString, file);
QFETCH(QStringList, abis); 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()); QCOMPARE(result.count(), abis.count());
for (int i = 0; i < abis.count(); ++i) for (int i = 0; i < abis.count(); ++i)
QCOMPARE(result.at(i).toString(), abis.at(i)); QCOMPARE(result.at(i).toString(), abis.at(i));
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include "projectexplorer_export.h" #include "projectexplorer_export.h"
#include <utils/fileutils.h>
#include <QtCore/QList> #include <QtCore/QList>
namespace ProjectExplorer { namespace ProjectExplorer {
...@@ -140,7 +142,7 @@ public: ...@@ -140,7 +142,7 @@ public:
static QList<OSFlavor> flavorsForOs(const OS &o); static QList<OSFlavor> flavorsForOs(const OS &o);
static Abi hostAbi(); static Abi hostAbi();
static QList<Abi> abisOfBinary(const QString &path); static QList<Abi> abisOfBinary(const Utils::FileName &path);
private: private:
Architecture m_architecture; Architecture m_architecture;
......
...@@ -411,7 +411,7 @@ Utils::FileName GccToolChain::mkspec() const ...@@ -411,7 +411,7 @@ Utils::FileName GccToolChain::mkspec() const
return Utils::FileName::fromString(QLatin1String("macx-g++")); 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; Abi gccAbi;
if (!gccAbiList.isEmpty()) if (!gccAbiList.isEmpty())
gccAbi = gccAbiList.first(); gccAbi = gccAbiList.first();
......
...@@ -633,7 +633,7 @@ QPair<QString, QString> MsvcToolChain::autoDetectCdbDebugger() ...@@ -633,7 +633,7 @@ QPair<QString, QString> MsvcToolChain::autoDetectCdbDebugger()
} }
foreach (const QString &cdb, cdbs) { 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()) if (abis.isEmpty())
continue; continue;
if (abis.first().wordWidth() == 32) if (abis.first().wordWidth() == 32)
......
...@@ -1179,7 +1179,7 @@ Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QStrin ...@@ -1179,7 +1179,7 @@ Utils::FileName BaseQtVersion::mkspecFromVersionInfo(const QHash<QString, QStrin
return mkspecFullPath; 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; QStringList dirs;
dirs << versionInfo.value(QLatin1String("QT_INSTALL_LIBS")) dirs << versionInfo.value(QLatin1String("QT_INSTALL_LIBS"))
...@@ -1197,8 +1197,9 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con ...@@ -1197,8 +1197,9 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con
&& file.startsWith(QLatin1String("QtCore")) && file.startsWith(QLatin1String("QtCore"))
&& file.endsWith(QLatin1String(".framework"))) { && file.endsWith(QLatin1String(".framework"))) {
// handle Framework // handle Framework
const QString libName = file.left(file.lastIndexOf(QLatin1Char('.'))); Utils::FileName lib(info);
return info.absoluteFilePath() + QLatin1Char('/') + libName; lib.appendPath(file.left(file.lastIndexOf(QLatin1Char('.'))));
return lib;
} }
if (info.isReadable()) { if (info.isReadable()) {
if (file.startsWith(QLatin1String("libQtCore")) if (file.startsWith(QLatin1String("libQtCore"))
...@@ -1209,18 +1210,18 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con ...@@ -1209,18 +1210,18 @@ QString BaseQtVersion::qtCorePath(const QHash<QString,QString> &versionInfo, con
else if (file.endsWith(QLatin1String(".dll")) else if (file.endsWith(QLatin1String(".dll"))
|| file.endsWith(QString::fromLatin1(".so.") + versionString) || file.endsWith(QString::fromLatin1(".so.") + versionString)
|| file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib"))) || file.endsWith(QLatin1Char('.') + versionString + QLatin1String(".dylib")))
return info.absoluteFilePath(); return Utils::FileName(info);
} }
} }
} }
} }
// Return path to first static library found: // Return path to first static library found:
if (!staticLibs.isEmpty()) if (!staticLibs.isEmpty())
return staticLibs.at(0).absoluteFilePath(); return Utils::FileName(staticLibs.at(0));
return QString(); 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); return ProjectExplorer::Abi::abisOfBinary(coreLibrary);
} }
...@@ -221,8 +221,8 @@ protected: ...@@ -221,8 +221,8 @@ protected:
virtual QList<ProjectExplorer::Task> reportIssuesImpl(const QString &proFile, const QString &buildDir); 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 // 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 Utils::FileName qtCorePath(const QHash<QString,QString> &versionInfo, const QString &versionString);
static QList<ProjectExplorer::Abi> qtAbisFromLibrary(const QString &coreLibrary); static QList<ProjectExplorer::Abi> qtAbisFromLibrary(const Utils::FileName &coreLibrary);
void ensureMkSpecParsed() const; void ensureMkSpecParsed() const;
virtual void parseMkSpec(ProFileEvaluator *) const; virtual void parseMkSpec(ProFileEvaluator *) const;
......
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