4
1
mirror of https://github.com/QuasarApp/CQtDeployer.git synced 2025-05-03 04:59:35 +00:00

Merge pull request from QuasarApp/extradataprefix

Added support prefixes for extra data
This commit is contained in:
Andrei Yankovich 2021-07-01 21:18:21 +03:00 committed by GitHub
commit b386644ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 17 deletions

@ -833,7 +833,7 @@ bool ConfigParser::setTargets(const QStringList &value) {
bool isfillList = false;
for (const auto &i : value) {
QFileInfo targetInfo = getBinInfo(i);
QFileInfo targetInfo = DeployCore::findFile(i);
if (i.isEmpty())
continue;
@ -867,21 +867,6 @@ bool ConfigParser::setTargets(const QStringList &value) {
return true;
}
QFileInfo ConfigParser::getBinInfo(const QString &bin) {
auto prefixes = QuasarAppUtils::Params::getArg("binPrefix").
split(DeployCore::getSeparator(0), splitbehavior);
for (const QString& prefix :qAsConst(prefixes)) {
QFileInfo info(prefix + "/" + bin);
if (info.isFile()) {
return info;
}
}
return QFileInfo(bin);
}
bool ConfigParser::setTargetsRecursive(const QString &dir) {
if (!setTargetsInDir(dir, true)) {
QuasarAppUtils::Params::log("setTargetsInDir failed!",

@ -67,7 +67,6 @@ private:
void setTargetDir(const QString &target = "");
bool setTargets(const QStringList &value);
QFileInfo getBinInfo(const QString& bin);
bool setTargetsRecursive(const QString &dir);
bool setTargetsInDir(const QString &dir, bool recursive = false);

@ -771,6 +771,21 @@ void DeployCore::printInternalError(const char * function, const char* file, int
" about this problem on the official github page"
" https://github.com/QuasarApp/CQtDeployer/issues/new/choose. "),
QuasarAppUtils::Error);
}
QFileInfo DeployCore::findFile(const QString &bin) {
auto prefixes = QuasarAppUtils::Params::getArg("binPrefix").
split(DeployCore::getSeparator(0), splitbehavior);
for (const QString& prefix :qAsConst(prefixes)) {
QFileInfo info(prefix + "/" + bin);
if (info.isFile()) {
return info;
}
}
return QFileInfo(bin);
};
QString DeployCore::systemLibsFolderName() {

@ -295,6 +295,13 @@ public:
*/
static void printInternalError(const char *function, const char* file, int line);
/**
* @brief findFile This method search input file in prefixes and return absolute path to the found file. If file is not exists the return empty string.
* @param file This is file path. If the file path si absalute path then return @a file value.
* @return file info of the found file.
*/
static QFileInfo findFile(const QString &file);
};
#define internalError() DeployCore::printInternalError(__FUNCTION__, __FILE__, __LINE__)

@ -112,6 +112,14 @@ void Extracter::extractExtraDataTargets() {
auto &dep = _packageDependencyes[i.key()];
const auto extraData = i.value().extraData();
for (const auto &target : extraData) {
QFileInfo info = DeployCore::findFile(target);
if (!info.exists()) {
QuasarAppUtils::Params::log("Failed to copy extra data from: " + target +
" Error: target not exists!.", QuasarAppUtils::Warning);
continue;
}
dep.addExtraData(target);
}
}