2019-08-25 12:06:01 +03:00
|
|
|
|
|
|
|
//#
|
2019-12-08 13:57:20 +03:00
|
|
|
//# Copyright (C) 2018-2020 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 {
|
|
|
|
return getRelativePath(basePath) + libOutDir;
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void DistroStruct::setLibOutDir(const QString &value) {
|
2019-08-28 18:03:55 +03:00
|
|
|
libOutDir = toFullPath(value);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
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) {
|
2019-08-28 18:03:55 +03:00
|
|
|
binOutDir = toFullPath(value);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
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) {
|
2019-08-28 18:03:55 +03:00
|
|
|
qmlOutDir = toFullPath(value);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
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) {
|
2019-08-28 18:03:55 +03:00
|
|
|
trOutDir = toFullPath(value);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
2019-08-26 21:16:47 +03:00
|
|
|
QString DistroStruct::getResOutDir(const QString &basePath) const {
|
|
|
|
return 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) {
|
2019-08-28 18:03:55 +03:00
|
|
|
resOutDir = toFullPath(value);
|
2019-08-25 12:06:01 +03:00
|
|
|
}
|
|
|
|
|
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) {
|
2019-08-28 18:03:55 +03:00
|
|
|
pluginsOutDir = toFullPath(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);
|
|
|
|
}
|
|
|
|
|
2019-12-10 18:43:01 +03:00
|
|
|
bool DistroStruct::isEmpty()
|
|
|
|
{
|
|
|
|
return (libOutDir.isEmpty() &&
|
|
|
|
qmlOutDir.isEmpty() &&
|
|
|
|
binOutDir.isEmpty() &&
|
|
|
|
trOutDir.isEmpty() &&
|
|
|
|
resOutDir.isEmpty() &&
|
|
|
|
pluginsOutDir.isEmpty());
|
2019-09-15 17:38:47 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|