mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-29 19:24:33 +00:00
33 lines
651 B
C++
33 lines
651 B
C++
|
#include "elf.h"
|
||
|
|
||
|
#include <QFileInfo>
|
||
|
|
||
|
ELF::ELF()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
|
||
|
bool ELF::getLibInfo(const QString &lib, LibInfo &info) {
|
||
|
ElfReader reader(lib);
|
||
|
|
||
|
auto headers = reader.readHeaders();
|
||
|
|
||
|
if (headers.elfclass == ElfClass::Elf_ELFCLASS32) {
|
||
|
info.platform = Unix32;
|
||
|
} else if (headers.elfclass == ElfClass::Elf_ELFCLASS64) {
|
||
|
info.platform = Unix64;
|
||
|
} else {
|
||
|
info.platform = UnknownPlatform;
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
info.name = QFileInfo(lib).fileName();
|
||
|
info.path = QFileInfo(lib).absolutePath();
|
||
|
|
||
|
for (auto &i : reader.dependencies()) {
|
||
|
info.dependncies.push_back(i);
|
||
|
}
|
||
|
|
||
|
return true;
|
||
|
}
|