make `isGreenEdition` constexpr on Unix (#392)

This commit is contained in:
Cyano Hao 2024-04-24 12:00:26 +08:00 committed by GitHub
parent 4797e53b61
commit 5e9d9504d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -335,10 +335,9 @@ int getNewFileNumber()
#ifdef Q_OS_WIN
static bool gIsGreenEdition = true;
static bool gIsGreenEditionInited = false;
#endif
bool isGreenEdition()
{
#ifdef Q_OS_WIN
if (!gIsGreenEditionInited) {
QString appPath = QApplication::instance()->applicationDirPath();
appPath = excludeTrailingPathDelimiter(localizePath(appPath));
@ -364,10 +363,8 @@ bool isGreenEdition()
gIsGreenEditionInited = true;
}
return gIsGreenEdition;
#else
return false;
#endif
}
#endif
QByteArray runAndGetOutput(const QString &cmd, const QString& workingDir, const QStringList& arguments,
const QByteArray &inputContent, bool inheritEnvironment,

View File

@ -155,7 +155,11 @@ void executeFile(const QString& fileName,
const QString& workingDir,
const QString& tempFile);
#ifdef Q_OS_WIN
bool isGreenEdition();
#else
constexpr bool isGreenEdition() { return false; }
#endif
#ifdef Q_OS_WIN
bool readRegistry(HKEY key, const QString& subKey, const QString& name, QString& value);