core/qmlglobal: add dataPath(), statePath() and cachePath()

This commit is contained in:
outfoxxed 2025-05-16 20:33:40 -07:00
parent c1c24c2998
commit a05c0de53b
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 30 additions and 0 deletions

View file

@ -202,6 +202,18 @@ QString QuickshellGlobal::cacheDir() const { // NOLINT
return QsPaths::instance()->shellCacheDir().path();
}
QString QuickshellGlobal::dataPath(const QString& path) const {
return this->dataDir() % '/' % path;
}
QString QuickshellGlobal::statePath(const QString& path) const {
return this->stateDir() % '/' % path;
}
QString QuickshellGlobal::cachePath(const QString& path) const {
return this->cacheDir() % '/' % path;
}
QVariant QuickshellGlobal::env(const QString& variable) { // NOLINT
auto vstr = variable.toStdString();
if (!qEnvironmentVariableIsSet(vstr.data())) return QVariant::fromValue(nullptr);