changeset: 97923:da8f2767b6cc branch: 3.5 parent: 97843:a9153eca5c72 user: Steve Dower date: Fri Sep 11 10:56:59 2015 -0700 files: Misc/NEWS Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp description: Issue #25071: Windows installer should not require TargetDir parameter when installing quietly diff -r a9153eca5c72 -r da8f2767b6cc Misc/NEWS --- a/Misc/NEWS Wed Sep 09 12:01:36 2015 -0700 +++ b/Misc/NEWS Fri Sep 11 10:56:59 2015 -0700 @@ -7,6 +7,11 @@ Release date: 2015-09-13 +Build +----- + +- Issue #25071: Windows installer should not require TargetDir + parameter when installing quietly What's New in Python 3.5.0 release candidate 4? =============================================== diff -r a9153eca5c72 -r da8f2767b6cc Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp --- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp Wed Sep 09 12:01:36 2015 -0700 +++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp Fri Sep 11 10:56:59 2015 -0700 @@ -723,6 +723,36 @@ 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