diff --git a/src/Squirrel/ShellFile.cs b/src/Squirrel/ShellFile.cs index fba6fcdb7..85a4b9a01 100644 --- a/src/Squirrel/ShellFile.cs +++ b/src/Squirrel/ShellFile.cs @@ -85,15 +85,6 @@ public static PROPERTYKEY PKEY_AppUserModel_ID { }; } } - - public static PROPERTYKEY PKEY_AppUserModel_RelaunchCommand { - get { - return new PROPERTYKEY() { - fmtid = Guid.ParseExact("{9F4C2855-9F79-4B39-A8D0-E1D42DE1D5F3}", "B"), - pid = new UIntPtr(2), - }; - } - } } [ComImport] @@ -878,14 +869,6 @@ public void SetAppUserModelId(string appId) propStore.SetValue(ref pkey, ref str); } - public void SetAppUserModelRelaunchCommand(string commandWithArgs) - { - var propStore = (IPropertyStore)linkW; - var pkey = PROPERTYKEY.PKEY_AppUserModel_ID; - var str = PropVariant.FromString (commandWithArgs); - propStore.SetValue(ref pkey, ref str); - } - /// /// Saves the shortcut to ShortCutFile. /// diff --git a/src/Squirrel/UpdateManager.ApplyReleases.cs b/src/Squirrel/UpdateManager.ApplyReleases.cs index 434d02c5f..9023fe4aa 100644 --- a/src/Squirrel/UpdateManager.ApplyReleases.cs +++ b/src/Squirrel/UpdateManager.ApplyReleases.cs @@ -188,7 +188,6 @@ public Dictionary GetShortcutsForExecutable(string } sl.SetAppUserModelId(String.Format("com.squirrel.{0}.{1}", zf.Id, exeName.Replace(".exe", ""))); - sl.SetAppUserModelRelaunchCommand(String.Format("{0} {1}", sl.Target, sl.Arguments)); ret.Add(f, sl); } @@ -512,20 +511,23 @@ void updateLink(ShellLink shortcut, string newAppPath) } this.Log().Info("Old iconPath is: '{0}'", shortcut.IconPath); - var iconPath = Path.Combine(newAppPath, Path.GetFileName(shortcut.IconPath)); - if (!File.Exists(iconPath) && targetIsUpdateDotExe) { - var executable = shortcut.Arguments.Replace("--processStart ", ""); - iconPath = Path.Combine(newAppPath, executable); - } + if (!File.Exists(shortcut.IconPath) || shortcut.IconPath.IndexOf("app-", StringComparison.OrdinalIgnoreCase) > 1) { + var iconPath = Path.Combine(newAppPath, Path.GetFileName(shortcut.IconPath)); + + if (!File.Exists(iconPath) && targetIsUpdateDotExe) { + var executable = shortcut.Arguments.Replace("--processStart ", ""); + iconPath = Path.Combine(newAppPath, executable); + } - this.Log().Info("Setting iconPath to: '{0}'", iconPath); - shortcut.IconPath = iconPath; + this.Log().Info("Setting iconPath to: '{0}'", iconPath); + shortcut.IconPath = iconPath; - if (!File.Exists(iconPath)) { - this.Log().Warn("Tried to use {0} for icon path but didn't exist, falling back to EXE", iconPath); + if (!File.Exists(iconPath)) { + this.Log().Warn("Tried to use {0} for icon path but didn't exist, falling back to EXE", iconPath); - shortcut.IconPath = target; - shortcut.IconIndex = 0; + shortcut.IconPath = target; + shortcut.IconIndex = 0; + } } this.ErrorIfThrows(() => Utility.Retry(() => shortcut.Save(), 2), "Couldn't write shortcut " + shortcut.ShortCutFile);