core/qmlglobal: expose cacheDir

This commit is contained in:
outfoxxed 2025-05-16 20:01:38 -07:00
parent fee4942771
commit 69c7f4fe77
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 16 additions and 0 deletions

View file

@ -21,6 +21,7 @@
#include "generation.hpp"
#include "iconimageprovider.hpp"
#include "paths.hpp"
#include "qmlscreen.hpp"
#include "rootwrapper.hpp"
@ -189,6 +190,14 @@ void QuickshellGlobal::setWatchFiles(bool watchFiles) { // NOLINT
QuickshellSettings::instance()->setWatchFiles(watchFiles);
}
QString QuickshellGlobal::cacheDir() const { // NOLINT
auto* dir = QsPaths::instance()->cacheDir();
if (dir) return dir->path();
qCritical() << "Could not find cache dir.";
return "/quickshell-cache-not-found";
}
QVariant QuickshellGlobal::env(const QString& variable) { // NOLINT
auto vstr = variable.toStdString();
if (!qEnvironmentVariableIsSet(vstr.data())) return QVariant::fromValue(nullptr);