Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pinning yet again srsly i hate pinning #591

Merged
merged 2 commits into from
Feb 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions src/Squirrel/ShellFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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);
}

/// <summary>
/// Saves the shortcut to ShortCutFile.
/// </summary>
Expand Down
26 changes: 14 additions & 12 deletions src/Squirrel/UpdateManager.ApplyReleases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public Dictionary<ShortcutLocation, ShellLink> 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);
}

Expand Down Expand Up @@ -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);
Expand Down