summaryrefslogtreecommitdiff
path: root/Tools/msi/bundle
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-10-11 15:37:22 -0700
committerSteve Dower <steve.dower@microsoft.com>2015-10-11 15:37:22 -0700
commit47f5b194ce427be1223fe5eb54baa7e3d66a94d7 (patch)
tree350be2311e8827db5175a5b57238b16a4fd3917d /Tools/msi/bundle
parent6d4ca7e06d413b191618543d5e768ea4d08280a8 (diff)
downloadcpython-47f5b194ce427be1223fe5eb54baa7e3d66a94d7.tar.gz
Issue #25163: Display correct directory in installer when using non-default settings.
Diffstat (limited to 'Tools/msi/bundle')
-rw-r--r--Tools/msi/bundle/Default.thm2
-rw-r--r--Tools/msi/bundle/Default.wxl2
-rw-r--r--Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp58
3 files changed, 38 insertions, 24 deletions
diff --git a/Tools/msi/bundle/Default.thm b/Tools/msi/bundle/Default.thm
index f575a98fa2..e223112f21 100644
--- a/Tools/msi/bundle/Default.thm
+++ b/Tools/msi/bundle/Default.thm
@@ -24,8 +24,8 @@
<Button Name="InstallButton" X="185" Y="101" Width="-11" Height="109" TabStop="yes" FontId="3" HexStyle="0xE">#(loc.InstallButton)</Button>
<Button Name="InstallCustomButton" X="185" Y="221" Width="-11" Height="59" TabStop="yes" FontId="3" HexStyle="0xE">#(loc.InstallCustomButton)</Button>
- <Checkbox Name="PrependPath" X="185" Y="-13" Width="-100" Height="24" TabStop="yes" FontId="3">#(loc.ShortPrependPathLabel)</Checkbox>
<Checkbox Name="InstallLauncherAllUsers" X="185" Y="-37" Width="-100" Height="24" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.ShortInstallLauncherAllUsersLabel)</Checkbox>
+ <Checkbox Name="PrependPath" X="185" Y="-13" Width="-100" Height="24" TabStop="yes" FontId="3">#(loc.ShortPrependPathLabel)</Checkbox>
<Button Name="InstallCancelButton" X="-11" Y="-11" Width="85" Height="27" TabStop="yes" FontId="0">#(loc.CancelButton)</Button>
</Page>
diff --git a/Tools/msi/bundle/Default.wxl b/Tools/msi/bundle/Default.wxl
index f3d89d9348..7357649fe0 100644
--- a/Tools/msi/bundle/Default.wxl
+++ b/Tools/msi/bundle/Default.wxl
@@ -42,7 +42,7 @@ Continue?</String>
<String Id="InstallLicenseLinkText">[WixBundleName] &lt;a href="#"&gt;license terms&lt;/a&gt;.</String>
<String Id="InstallAcceptCheckbox">I &amp;agree to the license terms and conditions</String>
<String Id="InstallButton">&amp;Install Now</String>
- <String Id="InstallButtonNote">[DefaultJustForMeTargetDir]
+ <String Id="InstallButtonNote">[TargetDir]
Includes IDLE, pip and documentation
Creates shortcuts and file associations</String>
diff --git a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
index bc418e0014..43f3017507 100644
--- a/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
+++ b/Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
@@ -293,28 +293,8 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
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 @@ private:
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 @@ public:
_baFunction = nullptr;
LoadOptionalFeatureStates(pEngine);
+ EnsureTargetDir();
}