CQtDeployer/Deploy/distrostruct.cpp

93 lines
2.1 KiB
C++
Raw Normal View History

2019-08-25 12:06:01 +03:00
#include "distrostruct.h"
2019-08-25 12:35:31 +03:00
#include <QRegExp>
2019-08-25 12:06:01 +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.
//#
2019-08-25 12:35:31 +03:00
QString DistroStruct::getLibOutDir(const QString &basePath) const {
return getRelativePath(basePath) + libOutDir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setLibOutDir(const QString &value) {
libOutDir = value;
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getBinOutDir(const QString &basePath) const {
return getRelativePath(basePath) + binOutDir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setBinOutDir(const QString &value) {
binOutDir = value;
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getQmlOutDir(const QString &basePath) const {
return getRelativePath(basePath) + qmlOutDir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setQmlOutDir(const QString &value) {
qmlOutDir = value;
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getTrOutDir(const QString &basePath) const {
return getRelativePath(basePath) + trOutDir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setTrOutDir(const QString &value) {
trOutDir = value;
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getResOutDeir(const QString &basePath) const {
return getRelativePath(basePath) + resOutDeir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setResOutDeir(const QString &value) {
resOutDeir = value;
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getPluginsOutDir(const QString &basePath) const {
return getRelativePath(basePath) + pluginsOutDir;
2019-08-25 12:06:01 +03:00
}
void DistroStruct::setPluginsOutDir(const QString &value) {
pluginsOutDir = value;
}
QString DistroStruct::getRootDir(const QString &basePath) const {
return getRelativePath(basePath);
}
2019-08-25 12:35:31 +03:00
QString DistroStruct::getRelativePath(QString path) const {
2019-08-26 08:46:53 +03:00
path.replace('\\', '/');
int index = -1;
do {
path.replace("//", "/");
} while ((index = path.indexOf("//")) >= 0);
if (path.left(1) != '/') {
path.insert(0, '/');
}
if (path.right(1) != '/') {
path.insert(path.size(), '/');
}
int count = path.count('/') - 1;
2019-08-25 12:35:31 +03:00
for (int i = 0; i < count; ++i) {
path += "../";
}
return path;
}
2019-08-25 12:06:01 +03:00
DistroStruct::DistroStruct() {
}