mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-06 19:14:57 +11:00
core/qmlglobal: add dataPath(), statePath() and cachePath()
This commit is contained in:
parent
c1c24c2998
commit
a05c0de53b
3 changed files with 30 additions and 0 deletions
|
|
@ -11,6 +11,7 @@
|
|||
#include <qloggingcategory.h>
|
||||
#include <qstandardpaths.h>
|
||||
#include <qtenvironmentvariables.h>
|
||||
#include <qtversionchecks.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "instanceinfo.hpp"
|
||||
|
|
@ -232,7 +233,18 @@ QDir QsPaths::shellDataDir() {
|
|||
|
||||
QDir QsPaths::shellStateDir() {
|
||||
if (this->shellStateState == DirState::Unknown) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 7, 0)
|
||||
QDir dir;
|
||||
if (qEnvironmentVariableIsSet("XDG_STATE_HOME")) {
|
||||
dir = QDir(qEnvironmentVariable("XDG_STATE_HOME"));
|
||||
} else {
|
||||
auto home = QDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
|
||||
dir = QDir(home.filePath(".local/state"));
|
||||
}
|
||||
#else
|
||||
auto dir = QDir(QStandardPaths::writableLocation(QStandardPaths::StateLocation));
|
||||
#endif
|
||||
|
||||
dir = QDir(dir.filePath("by-shell"));
|
||||
dir = QDir(dir.filePath(this->shellId));
|
||||
this->mShellStateDir = dir;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue