2019-08-25 12:06:01 +03:00
|
|
|
|
|
|
|
//#
|
2021-01-05 13:17:11 +03:00
|
|
|
//# Copyright (C) 2018-2021 QuasarApp.
|
2019-08-25 12:06:01 +03:00
|
|
|
//# 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-09-15 17:38:47 +03:00
|
|
|
#include "distrostruct.h"
|
2019-09-29 18:14:41 +03:00
|
|
|
#include "pathutils.h"
|
2019-09-15 17:38:47 +03:00
|
|
|
#include <quasarapp.h>
|
|
|
|
|
2019-08-25 12:35:31 +03:00
|
|
|
QString DistroStruct::getLibOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + libOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setLibOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
libOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-25 12:35:31 +03:00
|
|
|
QString DistroStruct::getBinOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + binOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setBinOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
binOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-25 12:35:31 +03:00
|
|
|
QString DistroStruct::getQmlOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + qmlOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setQmlOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
qmlOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-25 12:35:31 +03:00
|
|
|
QString DistroStruct::getTrOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + trOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setTrOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
trOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-26 21:16:47 +03:00
|
|
|
QString DistroStruct::getResOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + resOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-26 21:16:47 +03:00
|
|
|
void DistroStruct::setResOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
resOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-25 12:35:31 +03:00
|
|
|
QString DistroStruct::getPluginsOutDir(const QString &basePath) const {
|
2020-02-27 10:50:11 +03:00
|
|
|
return toFullPath(getRelativePath(basePath) + pluginsOutDir);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setPluginsOutDir(const QString &value) {
|
2020-02-27 10:50:11 +03:00
|
|
|
pluginsOutDir = value;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-26 10:44:12 +03:00
|
|
|
QString DistroStruct::getRootDir(const QString &basePath) const {
|
|
|
|
return getRelativePath(basePath);
|
|
|
|
}
|
|
|
|
|
2020-12-03 20:00:14 +03:00
|
|
|
bool DistroStruct::isEmpty() {
|
2019-12-10 18:43:01 +03:00
|
|
|
return (libOutDir.isEmpty() &&
|
|
|
|
qmlOutDir.isEmpty() &&
|
|
|
|
binOutDir.isEmpty() &&
|
|
|
|
trOutDir.isEmpty() &&
|
|
|
|
resOutDir.isEmpty() &&
|
|
|
|
pluginsOutDir.isEmpty());
|
2019-09-15 17:38:47 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-12-04 17:13:12 +03:00
|
|
|
QString DistroStruct::getExtraDataOutDir(const QString& basePath) const {
|
|
|
|
return toFullPath(getRelativePath(basePath) + extraDataOutDir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setExtraDataOutDir(const QString &value) {
|
|
|
|
extraDataOutDir = value;
|
|
|
|
}
|
|
|
|
|
2019-08-28 18:03:55 +03:00
|
|
|
QString DistroStruct::toFullPath(QString path) const {
|
2019-09-29 18:14:41 +03:00
|
|
|
return PathUtils::toFullPath(path);
|
2019-08-28 18:03:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QString DistroStruct::stripPath(QString path) const {
|
2019-09-29 18:14:41 +03:00
|
|
|
return PathUtils::stripPath(path);
|
2019-08-28 18:03:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QString DistroStruct::getRelativePath(QString path) const {
|
2019-09-29 18:14:41 +03:00
|
|
|
return PathUtils::getReleativePath(path);
|
2019-08-25 12:35:31 +03:00
|
|
|
}
|
|
|
|
|
2019-08-25 12:06:01 +03:00
|
|
|
DistroStruct::DistroStruct() {
|
2020-01-02 19:27:40 +03:00
|
|
|
#ifdef Q_OS_LINUX
|
|
|
|
setBinOutDir("/bin");
|
|
|
|
setLibOutDir("/lib");
|
|
|
|
#else
|
|
|
|
setBinOutDir("/");
|
|
|
|
setLibOutDir("/");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
setQmlOutDir("/qml");
|
|
|
|
setTrOutDir("/translations");
|
|
|
|
setPluginsOutDir("/plugins");
|
|
|
|
setResOutDir("/resources");
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|