mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
Merge pull request #1141 from mattias-symphony/SDA-2745
fix: SDA-2745 Added support for APPDIR parameter
This commit is contained in:
@@ -119,11 +119,11 @@ class Script
|
||||
// Add registry entry used by protocol handler to launch symphony when opening symphony:// URIs
|
||||
new RegValue(WixSharp.RegistryHive.ClassesRoot, productName + @"\shell\open\command", "", "\"[INSTALLDIR]Symphony.exe\" \"%1\""),
|
||||
|
||||
// When installing or uninstalling, we want Symphony to be closed down, but the standard way of sending a WM_CLOSE message
|
||||
// will not work for us, as we have a "minimize on close" option, which stops the app from terminating on WM_CLOSE. So we
|
||||
// instruct the installer to not send a Close message, but instead send the EndSession message, and we have a custom event
|
||||
// When installing or uninstalling, we want Symphony to be closed down, but the standard way of sending a WM_CLOSE message
|
||||
// will not work for us, as we have a "minimize on close" option, which stops the app from terminating on WM_CLOSE. So we
|
||||
// instruct the installer to not send a Close message, but instead send the EndSession message, and we have a custom event
|
||||
// handler in the SDA code which listens for this message, and ensures app termination when it is received.
|
||||
new CloseApplication("Symphony.exe", false) { EndSessionMessage = true }
|
||||
new CloseApplication("Symphony.exe", false) { EndSessionMessage = true }
|
||||
);
|
||||
|
||||
// The build script which calls the wix# builder, will be run from a command environment which has %SYMVER% set.
|
||||
@@ -138,9 +138,9 @@ class Script
|
||||
// https://stackoverflow.com/a/26344742
|
||||
project.GUID = new System.Guid("{4042AD1C-90E1-4032-B6B9-2BF6A4214096}");
|
||||
project.ProductId = System.Guid.NewGuid();
|
||||
project.UpgradeCode = new System.Guid("{36402281-8141-4797-8A90-07CFA75EFA55}");
|
||||
|
||||
// Allow any versions to be upgraded/downgraded freely
|
||||
project.UpgradeCode = new System.Guid("{36402281-8141-4797-8A90-07CFA75EFA55}");
|
||||
|
||||
// Allow any versions to be upgraded/downgraded freely
|
||||
project.MajorUpgradeStrategy = MajorUpgradeStrategy.Default;
|
||||
project.MajorUpgradeStrategy.RemoveExistingProductAfter = Step.InstallInitialize;
|
||||
project.MajorUpgradeStrategy.UpgradeVersions.Minimum = "0.0.0";
|
||||
@@ -156,6 +156,7 @@ class Script
|
||||
// these when running the installer, but if not specified, the defaults will be used.
|
||||
project.Properties = new[]
|
||||
{
|
||||
new PublicProperty("APPDIR", ""),
|
||||
new PublicProperty("ALLUSERS", "1"),
|
||||
new PublicProperty("ALWAYS_ON_TOP", "DISABLED" ),
|
||||
new PublicProperty("AUTO_LAUNCH_PATH", ""),
|
||||
@@ -239,7 +240,7 @@ class Script
|
||||
// Generate an MSI from all settings done above
|
||||
Compiler.BuildMsi(project);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void project_Load(SetupEventArgs e)
|
||||
{
|
||||
@@ -250,19 +251,25 @@ class Script
|
||||
// "ALLUSERS" will be set to "2" if installing through UI, so the "MSIINSTALLPERUSER" property can be used so the user can choose install scope
|
||||
if (e.Session["ALLUSERS"] != "2" )
|
||||
{
|
||||
// If "ALLUSERS" is "1" or "", this is a quiet command line installation, and we need to set the right paths here, since the UI haven't
|
||||
if (e.Session["ALLUSERS"] == "")
|
||||
// If "ALLUSERS" is "1" or "", this is a quiet command line installation, and we need to set the right paths here, since the UI haven't.
|
||||
|
||||
if (e.Session["APPDIR"] != "")
|
||||
{
|
||||
// If "APPDIR" param was specified, just use that as is
|
||||
e.Session["INSTALLDIR"] = e.Session["APPDIR"];
|
||||
}
|
||||
else if (e.Session["ALLUSERS"] == "")
|
||||
{
|
||||
// Install for current user
|
||||
e.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + e.ProductName);
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
// Install for all users
|
||||
e.Session["INSTALLDIR"] = e.Session["PROGRAMSFOLDER"] + @"\Symphony\" + e.ProductName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Try to close all running symphony instances before installing. Since we have started using the EndSession message to tell the app to exit,
|
||||
// we don't really need to force terminate anymore. But the older versions of SDA does not listen for the EndSession event, so we still need
|
||||
// this code to ensure older versions gets shut down properly.
|
||||
|
||||
@@ -49,19 +49,32 @@ namespace Symphony
|
||||
// To enable Wix to use the "MSIINSTALLPERUSER" property being set below, ALLUSERS must be set to 2
|
||||
Runtime.Session["ALLUSERS"] = "2";
|
||||
|
||||
|
||||
var installDir = "";
|
||||
if (radioButtonCurrentUser.Checked)
|
||||
{
|
||||
// Install for current user
|
||||
Runtime.Session["MSIINSTALLPERUSER"] = "1"; // per-user
|
||||
Runtime.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + Runtime.ProductName);
|
||||
} else if (radioButtonAllUsers.Checked)
|
||||
}
|
||||
else if (radioButtonAllUsers.Checked)
|
||||
{
|
||||
// Install for all users
|
||||
Runtime.Session["MSIINSTALLPERUSER"] = ""; // per-machine
|
||||
Runtime.Session["INSTALLDIR"] = Runtime.Session["PROGRAMSFOLDER"] + @"\Symphony\" + Runtime.ProductName;
|
||||
}
|
||||
|
||||
// Set INSTALLDIR
|
||||
if( Runtime.Session["APPDIR"] != "" )
|
||||
{
|
||||
// If APPDIR param was specified, just use that as is
|
||||
Runtime.Session["INSTALLDIR"] = Runtime.Session["APPDIR"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply the install dir as determined by radio buttons
|
||||
Runtime.Session["INSTALLDIR"] = installDir;
|
||||
}
|
||||
|
||||
// Detect if Symphony is running
|
||||
bool isRunning = System.Diagnostics.Process.GetProcessesByName("Symphony").Length > 1;
|
||||
if (isRunning)
|
||||
|
||||
@@ -31,6 +31,27 @@ or
|
||||
msiexec /i Symphony.msi /q ALLUSERS=""
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
### APPDIR
|
||||
|
||||
Expected values:
|
||||
|
||||
* Full file path for target location to install Symphony to
|
||||
|
||||
The default value differs depending on ALLUSERS setting.
|
||||
|
||||
* %LOCALAPPDATA%\Programs\Symphony\Symphony
|
||||
If installing *Only for me* (ALLUSERS="")
|
||||
* %PROGRAMFILES%\Symphony\Symphony
|
||||
If installing *For all users* (ALLUSERS="1")
|
||||
|
||||
#### Example
|
||||
|
||||
msiexec /i Symphony.msi /q APPDIR="C:\Program Files\Symphony"
|
||||
|
||||
|
||||
|
||||
-------------------------------------------------------------------
|
||||
### ALWAYS_ON_TOP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user