]> granicus.if.org Git - python/commitdiff
Issue #25071: Windows installer should not require TargetDir parameter when installin...
authorSteve Dower <steve.dower@microsoft.com>
Fri, 11 Sep 2015 17:56:59 +0000 (10:56 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Fri, 11 Sep 2015 17:56:59 +0000 (10:56 -0700)
Misc/NEWS
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp

index f57280a29a40b219de252bcd8ec9bd2e42843570..df3b9d8867651f024146b5887353cae0ec3dffb0 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -7,6 +7,11 @@ What's New in Python 3.5.0 final?
 
 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?
 ===============================================
index 416f2d5e1999368566d89115d74a98d1470c965c..35ed2fe73bef06124d3bfa1c4d7fac81229c2059 100644 (file)
@@ -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