fix updater, fix multiple crashes

This commit is contained in:
Jakob 2021-09-09 19:54:44 +02:00
parent 051c4df2b6
commit 7169325e7e
3 changed files with 33 additions and 12 deletions

View file

@ -58,13 +58,15 @@ namespace EnvyUpdate
/// <param name="shortcutPath"></param>
/// <param name="targetFileLocation"></param>
/// <param name="description"></param>
public static void CreateShortcut(string shortcutName, string shortcutPath, string targetFileLocation, string description)
/// <param name="arguments"></param>
public static void CreateShortcut(string shortcutName, string shortcutPath, string targetFileLocation, string description, string arguments = "")
{
// It seems unnecessarily complex to create a simple shortcut using C#. Oh well.
string shortcutLocation = Path.Combine(shortcutPath, shortcutName + ".lnk");
WshShell shell = new WshShell();
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutLocation);
shortcut.Arguments = arguments;
shortcut.Description = description;
shortcut.TargetPath = targetFileLocation;
shortcut.Save();