diff options
author | Johanna Äijälä <johanna.aijala@qt.io> | 2019-10-10 12:09:43 +0300 |
---|---|---|
committer | Johanna Äijälä <johanna.aijala@qt.io> | 2019-10-11 06:32:27 +0000 |
commit | 1b96174671cd5875c72783b79625848dc717d18c (patch) | |
tree | 0579dbe233c434ad9b2a91e1b5b7ea3d1a427c35 /src | |
parent | c706665c4f5efbe75633502b67c365be41d11a10 (diff) |
Fix env variable remove on Windows
Removing env variable failed on uninstallation on Windows if the env
variable value had @TargetDir@ in path. File separators got changed
from Windows style to unix style.
Update documentation to inform users to use '\\' as separators when
setting a path as environment variable.
Tested with following values (component.addElevatedOperation(...)
in components.qs):
"@TargetDir@\\lib\\system\\qtplugins"
"not_a_path_but_variable_with_slash_\\qtplugins"
"not_a_path_but_variable_with_slash_/qtplugins"
"%SystemRoot%\\lib\\system\\qtplugins"
"12345"
Task-number: QTIFW-1148
Change-Id: Iaa48d890e70afdbe56bbf389dd4994d5ae91b316
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/environmentvariablesoperation.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libs/installer/environmentvariablesoperation.cpp b/src/libs/installer/environmentvariablesoperation.cpp index 006ea3762..1f3b56d52 100644 --- a/src/libs/installer/environmentvariablesoperation.cpp +++ b/src/libs/installer/environmentvariablesoperation.cpp @@ -152,8 +152,18 @@ UpdateOperation::Error undoSetting(const QString ®Path, SettingsType registry(regPath, QSettingsWrapper::NativeFormat); actual = registry.value(name).toString(); } - if (actual != value) //key changed, don't undo - return UpdateOperation::UserDefinedError; + + 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 + QString tempValue = value; + QString fixedValue = tempValue.replace(QLatin1Char('/'), QLatin1Char('\\')); + + if (actual != fixedValue) //key changed, don't undo + return UpdateOperation::UserDefinedError; + } bool error = false; if (handleRegExpandSz(regPath, name, oldValue, errorString, &error)) |