mirror of
https://github.com/quickshell-mirror/quickshell.git
synced 2026-10-27 02:54:36 +00:00
core: add env and isEnvSet functions to pragma context
This commit is contained in:
2 files changed
+12
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include "scanenv.hpp"
|
||||
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qtenvironmentvariables.h>
|
||||
|
||||
#include "build.hpp"
|
||||
|
||||
@@ -19,4 +20,12 @@ bool PreprocEnv::hasVersion(int major, int minor, const QStringList& features) {
|
||||
return QS_VERSION_MAJOR == major && QS_VERSION_MINOR == minor;
|
||||
}
|
||||
|
||||
QString PreprocEnv::env(const QString& variable) {
|
||||
return qEnvironmentVariable(variable.toStdString().c_str());
|
||||
}
|
||||
|
||||
bool PreprocEnv::isEnvSet(const QString& variable) {
|
||||
return qEnvironmentVariableIsSet(variable.toStdString().c_str());
|
||||
}
|
||||
|
||||
} // namespace qs::scan::env
|
||||
@@ -12,6 +12,9 @@ class PreprocEnv: public QObject {
|
||||
public:
|
||||
Q_INVOKABLE static bool
|
||||
hasVersion(int major, int minor, const QStringList& features = QStringList());
|
||||
|
||||
Q_INVOKABLE static QString env(const QString& variable);
|
||||
Q_INVOKABLE static bool isEnvSet(const QString& variable);
|
||||
};
|
||||
|
||||
} // namespace qs::scan::env
|
||||
Reference in new issue
Block a user