diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-09-11 17:56:59 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-09-11 17:56:59 (GMT) |
commit | 76b7133f58ebd47cb7eb20c6cb760141dc5bd0b2 (patch) | |
tree | a04233c6023cfd1199c6bf42f38ec0fc03b4b675 /Tools/msi/bundle | |
parent | 0db1c42c6556620301a79970a869519e8669dae5 (diff) | |
download | cpython-76b7133f58ebd47cb7eb20c6cb760141dc5bd0b2.zip cpython-76b7133f58ebd47cb7eb20c6cb760141dc5bd0b2.tar.gz cpython-76b7133f58ebd47cb7eb20c6cb760141dc5bd0b2.tar.bz2 |
Issue #25071: Windows installer should not require TargetDir parameter when installing quietly
Diffstat (limited to 'Tools/msi/bundle')
-rw-r--r-- | Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp index 416f2d5..35ed2fe 100644 --- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp +++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp @@ -723,6 +723,36 @@ public: // IBootstrapperApplication hrStatus = EvaluateConditions(); } + if (SUCCEEDED(hrStatus)) { + // Ensure the default path has been set + LONGLONG installAll; + LPWSTR targetDir = nullptr; + LPWSTR defaultTargetDir = nullptr; + + hrStatus = BalGetStringVariable(L"TargetDir", &targetDir); + if (FAILED(hrStatus) || !targetDir || !targetDir[0]) { + ReleaseStr(targetDir); + targetDir = nullptr; + + if (FAILED(BalGetNumericVariable(L"InstallAllUsers", &installAll))) { + installAll = 0; + } + + hrStatus = BalGetStringVariable( + installAll ? L"DefaultAllUsersTargetDir" : L"DefaultJustForMeTargetDir", + &defaultTargetDir + ); + + if (SUCCEEDED(hrStatus) && defaultTargetDir) { + if (defaultTargetDir[0] && SUCCEEDED(BalFormatString(defaultTargetDir, &targetDir))) { + hrStatus = _engine->SetVariableString(L"TargetDir", targetDir); + ReleaseStr(targetDir); + } + ReleaseStr(defaultTargetDir); + } + } + } + SetState(PYBA_STATE_DETECTED, hrStatus); // If we're not interacting with the user or we're doing a layout or we're just after a force restart |