changeset: 98694:6f97c51b6dc5 parent: 98692:3cf8c2930373 parent: 98693:919b1dffa741 user: Steve Dower date: Sun Oct 11 15:37:36 2015 -0700 files: Misc/NEWS description: Issue #25163: Display correct directory in installer when using non-default settings. diff -r 3cf8c2930373 -r 6f97c51b6dc5 Misc/NEWS --- a/Misc/NEWS Sun Oct 11 15:16:21 2015 -0700 +++ b/Misc/NEWS Sun Oct 11 15:37:36 2015 -0700 @@ -459,6 +459,9 @@ Windows ------- +- Issue #25163: Display correct directory in installer when using non-default + settings. + - Issue #25361: Disables use of SSE2 instructions in Windows 32-bit build - Issue #25089: Adds logging to installer for case where launcher is not diff -r 3cf8c2930373 -r 6f97c51b6dc5 Tools/msi/bundle/Default.thm --- a/Tools/msi/bundle/Default.thm Sun Oct 11 15:16:21 2015 -0700 +++ b/Tools/msi/bundle/Default.thm Sun Oct 11 15:37:36 2015 -0700 @@ -24,8 +24,8 @@ + #(loc.ShortInstallLauncherAllUsersLabel) #(loc.ShortPrependPathLabel) - #(loc.ShortInstallLauncherAllUsersLabel) diff -r 3cf8c2930373 -r 6f97c51b6dc5 Tools/msi/bundle/Default.wxl --- a/Tools/msi/bundle/Default.wxl Sun Oct 11 15:16:21 2015 -0700 +++ b/Tools/msi/bundle/Default.wxl Sun Oct 11 15:37:36 2015 -0700 @@ -42,7 +42,7 @@ [WixBundleName] <a href="#">license terms</a>. I &agree to the license terms and conditions &Install Now - [DefaultJustForMeTargetDir] + [TargetDir] Includes IDLE, pip and documentation Creates shortcuts and file associations diff -r 3cf8c2930373 -r 6f97c51b6dc5 Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp --- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp Sun Oct 11 15:16:21 2015 -0700 +++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp Sun Oct 11 15:37:36 2015 -0700 @@ -293,28 +293,8 @@ hr = _engine->SetVariableNumeric(L"CompileAll", installAllUsers); ExitOnFailure(hr, L"Failed to update CompileAll"); - hr = BalGetStringVariable(L"TargetDir", &targetDir); - if (FAILED(hr) || !targetDir || !targetDir[0]) { - ReleaseStr(targetDir); - targetDir = nullptr; - - hr = BalGetStringVariable( - installAllUsers ? L"DefaultAllUsersTargetDir" : L"DefaultJustForMeTargetDir", - &defaultDir - ); - BalExitOnFailure(hr, "Failed to get the default install directory"); - - if (!defaultDir || !defaultDir[0]) { - BalLogError(E_INVALIDARG, "Default install directory is blank"); - } - - hr = BalFormatString(defaultDir, &targetDir); - BalExitOnFailure1(hr, "Failed to format '%ls'", defaultDir); - - hr = _engine->SetVariableString(L"TargetDir", targetDir); - BalExitOnFailure(hr, "Failed to set install target directory"); - } - ReleaseStr(targetDir); + hr = EnsureTargetDir(); + ExitOnFailure(hr, L"Failed to set TargetDir"); OnPlan(BOOTSTRAPPER_ACTION_INSTALL); break; @@ -2972,6 +2952,39 @@ return; } + HRESULT EnsureTargetDir() { + LONGLONG installAllUsers; + LPWSTR targetDir = nullptr, defaultDir = nullptr; + HRESULT hr = BalGetStringVariable(L"TargetDir", &targetDir); + if (FAILED(hr) || !targetDir || !targetDir[0]) { + ReleaseStr(targetDir); + targetDir = nullptr; + + hr = BalGetNumericVariable(L"InstallAllUsers", &installAllUsers); + ExitOnFailure(hr, L"Failed to get install scope"); + + hr = BalGetStringVariable( + installAllUsers ? L"DefaultAllUsersTargetDir" : L"DefaultJustForMeTargetDir", + &defaultDir + ); + BalExitOnFailure(hr, "Failed to get the default install directory"); + + if (!defaultDir || !defaultDir[0]) { + BalLogError(E_INVALIDARG, "Default install directory is blank"); + } + + hr = BalFormatString(defaultDir, &targetDir); + BalExitOnFailure1(hr, "Failed to format '%ls'", defaultDir); + + hr = _engine->SetVariableString(L"TargetDir", targetDir); + BalExitOnFailure(hr, "Failed to set install target directory"); + } + LExit: + ReleaseStr(defaultDir); + ReleaseStr(targetDir); + return hr; + } + public: // // Constructor - initialize member variables. @@ -3057,6 +3070,7 @@ _baFunction = nullptr; LoadOptionalFeatureStates(pEngine); + EnsureTargetDir(); }