Skip to content

Commit

Permalink
Make sure fixing pinned shortcuts includes the icon
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Jul 20, 2015
1 parent 8dce16f commit e2c3134
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Squirrel/UpdateManager.ApplyReleases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ void updateLink(ShellLink shortcut, string[] oldAppDirectories, string newAppPat
this.Log().Info("Processing shortcut '{0}'", shortcut.Target);

foreach (var oldAppDirectory in oldAppDirectories) {
if (!shortcut.Target.StartsWith(oldAppDirectory, StringComparison.OrdinalIgnoreCase)) {
if (!shortcut.Target.StartsWith(oldAppDirectory, StringComparison.OrdinalIgnoreCase) && !shortcut.IconPath.StartsWith(oldAppDirectory, StringComparison.OrdinalIgnoreCase)) {
this.Log().Info("Does not match '{0}', continuing to next directory", oldAppDirectory);
continue;
}
Expand All @@ -483,9 +483,14 @@ void updateLink(ShellLink shortcut, string[] oldAppDirectories, string newAppPat
shortcut.WorkingDirectory.Substring(oldAppDirectory.Length + 1));
}

// replace working directory too if appropriate
if (shortcut.IconPath.StartsWith(oldAppDirectory, StringComparison.OrdinalIgnoreCase)) {
this.Log().Info("Changing new directory to '{0}'", newAppPath);
shortcut.IconPath = Path.Combine(newAppPath, shortcut.IconPath.Substring(oldAppDirectory.Length + 1));
}

shortcut.Save();
}
else {
} else {
this.Log().Info("Unpinning {0} from taskbar", shortcut.Target);
TaskbarHelper.UnpinFromTaskbar(shortcut.Target);
}
Expand Down

0 comments on commit e2c3134

Please sign in to comment.