forked from qt-creator/qt-creator
ProjectExplorer: Use FilePath::readContents() for API detection
Change-Id: I3f19ed8ffc99f43fde4b7e5edbb53f92c7ef17ab Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QtEndian>
|
#include <QtEndian>
|
||||||
#include <QFile>
|
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
@@ -1168,9 +1167,6 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
|
|||||||
&& getUint8(data, 6) == '>' && getUint8(data, 7) == 0x0a) {
|
&& getUint8(data, 6) == '>' && getUint8(data, 7) == 0x0a) {
|
||||||
// We got an ar file: possibly a static lib for ELF, PE or Mach-O
|
// We got an ar file: possibly a static lib for ELF, PE or Mach-O
|
||||||
|
|
||||||
QFile f(path.toString());
|
|
||||||
const bool canRead = f.open(QFile::ReadOnly);
|
|
||||||
|
|
||||||
data = data.mid(8); // Cut of ar file magic
|
data = data.mid(8); // Cut of ar file magic
|
||||||
quint64 offset = 8;
|
quint64 offset = 8;
|
||||||
|
|
||||||
@@ -1196,14 +1192,8 @@ Abis Abi::abisOfBinary(const Utils::FilePath &path)
|
|||||||
if (!tmp.isEmpty() && tmp.at(0).binaryFormat() != MachOFormat)
|
if (!tmp.isEmpty() && tmp.at(0).binaryFormat() != MachOFormat)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!canRead) {
|
|
||||||
// FIXME: Implement remote
|
|
||||||
QTC_ASSERT(!path.needsDevice(), return {});
|
|
||||||
}
|
|
||||||
|
|
||||||
offset += (offset % 2); // ar is 2 byte aligned
|
offset += (offset % 2); // ar is 2 byte aligned
|
||||||
f.seek(offset);
|
data = path.fileContents(1024, offset);
|
||||||
data = f.read(1024);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tmp = abiOf(data);
|
tmp = abiOf(data);
|
||||||
|
Reference in New Issue
Block a user