2019-01-26 07:54:56 +03:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018-2019 QuasarApp.
|
|
|
|
* Distributed under the lgplv3 software license, see the accompanying
|
|
|
|
* Everyone is permitted to copy and distribute verbatim copies
|
|
|
|
* of this license document, but changing it is not allowed.
|
|
|
|
*/
|
|
|
|
|
2018-11-15 18:00:23 +03:00
|
|
|
#include "windependenciesscanner.h"
|
2018-12-09 17:35:07 +03:00
|
|
|
#include "deployutils.h"
|
2018-11-15 18:00:23 +03:00
|
|
|
|
|
|
|
#include <QList>
|
2018-11-18 17:22:05 +03:00
|
|
|
#include <QDir>
|
2018-11-26 16:17:46 +03:00
|
|
|
#include <QDebug>
|
2018-11-15 18:00:23 +03:00
|
|
|
|
|
|
|
WinDependenciesScanner::WinDependenciesScanner() {}
|
|
|
|
|
2019-03-17 18:42:07 +03:00
|
|
|
|
|
|
|
bool WinDependenciesScanner::fillLibInfo(LibInfo &info, const QString &file) {
|
|
|
|
|
2018-12-09 17:35:07 +03:00
|
|
|
}
|
|
|
|
|
2018-11-23 14:56:55 +03:00
|
|
|
void WinDependenciesScanner::setEnvironment(const QStringList &env) {
|
2018-11-18 17:22:05 +03:00
|
|
|
QDir dir;
|
2018-11-23 14:56:55 +03:00
|
|
|
for (auto i : env) {
|
2018-12-09 17:35:07 +03:00
|
|
|
|
2018-11-18 17:22:05 +03:00
|
|
|
dir.setPath(i);
|
|
|
|
if (!dir.exists()) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-11-23 14:56:55 +03:00
|
|
|
auto list = dir.entryInfoList(QStringList() << "*.dll",
|
2018-11-18 17:22:05 +03:00
|
|
|
QDir::Files| QDir::NoDotAndDotDot);
|
|
|
|
|
2018-11-23 14:56:55 +03:00
|
|
|
for (auto i : list) {
|
2018-12-09 17:35:07 +03:00
|
|
|
|
|
|
|
auto newPriority = DeployUtils::getLibPriority(i.absoluteFilePath());
|
|
|
|
auto oldPriority = DeployUtils::getLibPriority(_EnvLibs.value(i.fileName(), ""));
|
|
|
|
|
|
|
|
if (newPriority > oldPriority)
|
|
|
|
_EnvLibs.insert(i.fileName(), i.absoluteFilePath());
|
2018-11-23 14:56:55 +03:00
|
|
|
}
|
2018-11-18 17:22:05 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-12-09 17:35:07 +03:00
|
|
|
QStringList WinDependenciesScanner::scan(const QString &path, Platform platfr,
|
|
|
|
const QString& qmake) {
|
2018-11-18 17:22:05 +03:00
|
|
|
QStringList result;
|
|
|
|
|
2018-11-26 16:17:46 +03:00
|
|
|
QString errorMessage;
|
|
|
|
|
2018-12-01 21:04:52 +03:00
|
|
|
if (platfr == Platform::UnknownPlatform) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2018-11-26 16:17:46 +03:00
|
|
|
QStringList dep;
|
2019-03-18 10:33:03 +03:00
|
|
|
// readExecutable(path, platfr, &errorMessage, &dep);
|
2018-11-26 16:17:46 +03:00
|
|
|
|
|
|
|
if (!errorMessage.isEmpty()) {
|
|
|
|
qCritical() << errorMessage;
|
|
|
|
return result;
|
|
|
|
}
|
2018-11-18 17:22:05 +03:00
|
|
|
|
2018-11-23 14:56:55 +03:00
|
|
|
for (auto i : dep) {
|
|
|
|
QString lib(i);
|
|
|
|
if (_EnvLibs.count(lib)) {
|
|
|
|
result.push_back(_EnvLibs.value(lib));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-18 17:22:05 +03:00
|
|
|
return result;
|
2018-11-15 18:00:23 +03:00
|
|
|
}
|
2018-11-23 14:56:55 +03:00
|
|
|
|
|
|
|
WinDependenciesScanner::~WinDependenciesScanner() {
|
|
|
|
|
|
|
|
}
|