From 46cb165e2286706db7bcec34da1d6898fe3143e3 Mon Sep 17 00:00:00 2001 From: Mattias Gustavsson Date: Mon, 16 Nov 2020 13:41:57 +0100 Subject: [PATCH] SDA-2681 Ensuring correct paths and function for silent install --- installer/win/WixSharpInstaller/Symphony.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/installer/win/WixSharpInstaller/Symphony.cs b/installer/win/WixSharpInstaller/Symphony.cs index 3cfc5d01..17168953 100644 --- a/installer/win/WixSharpInstaller/Symphony.cs +++ b/installer/win/WixSharpInstaller/Symphony.cs @@ -150,7 +150,7 @@ class Script // these when running the installer, but if not specified, the defaults will be used. project.Properties = new[] { - new PublicProperty("ALLUSERS", "true"), + new PublicProperty("ALLUSERS", "1"), new PublicProperty("ALWAYS_ON_TOP", "DISABLED" ), new PublicProperty("AUTO_LAUNCH_PATH", ""), new PublicProperty("AUTO_START", "ENABLED"), @@ -252,6 +252,22 @@ class Script { try { + // "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"] == "") + { + // Install for current user + e.Session["INSTALLDIR"] = System.Environment.ExpandEnvironmentVariables(@"%LOCALAPPDATA%\Programs\Symphony\" + e.ProductName); + } + else + { + // Install for all users + e.Session["INSTALLDIR"] = e.Session["PROGRAMSFOLDER"] + @"\Symphony\" + e.ProductName; + } + } + // Try to close all running symphony instances before installing KillSymphonyProcesses();