diff options
Diffstat (limited to 'src/libs/installer/environmentvariablesoperation.cpp')
-rw-r--r-- | src/libs/installer/environmentvariablesoperation.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp index 2f55172e1..94cd1e36f 100644 --- a/src/libs/installer/environmentvariablesoperation.cpp +++ b/src/libs/installer/environmentvariablesoperation.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2023 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -30,6 +30,7 @@ #include "qsettingswrapper.h" #include <stdlib.h> +#include <QDir> #include "environment.h" #include "globals.h" @@ -110,6 +111,12 @@ bool handleRegExpandSz(const QString ®Path, const QString &name, } } } +#else + Q_UNUSED(regPath) + Q_UNUSED(name) + Q_UNUSED(value) + Q_UNUSED(errorString) + Q_UNUSED(error) #endif return setAsExpandSZ; } @@ -122,7 +129,7 @@ UpdateOperation::Error writeSetting(const QString ®Path, QString *oldValue) { oldValue->clear(); - SettingsType registry(regPath, QSettingsWrapper::NativeFormat); + SettingsType registry(regPath, QSettings::NativeFormat); if (!registry.isWritable()) { *errorString = UpdateOperation::tr("Registry path %1 is not writable.").arg(regPath); return UpdateOperation::UserDefinedError; @@ -156,17 +163,17 @@ UpdateOperation::Error undoSetting(const QString ®Path, { QString actual; { - SettingsType registry(regPath, QSettingsWrapper::NativeFormat); + SettingsType registry(regPath, QSettings::NativeFormat); actual = registry.value(name).toString(); } if (actual != value) { - //For unknown reason paths with @TargetDir@ variable get modified - //so that Windows file separators get replaced with unix style separators, - //fix separators before matching to actual value in register + //Ignore the separators + static const QRegularExpression regex(QLatin1String("(\\\\|/)")); QString tempValue = value; - QString fixedValue = tempValue.replace(QLatin1Char('/'), QLatin1Char('\\')); + QString fixedValue = tempValue.replace(regex, QDir::separator()); + actual = actual.replace(regex, QDir::separator()); if (actual != fixedValue) //key changed, don't undo return UpdateOperation::UserDefinedError; |