Skip to content

Commit 69a883d

Browse files
authored
Merge pull request #1674 from vidia/onlyUpdateShortcuts
Added CLI flag to onlyUpdate shortcuts
2 parents eef3746 + 9a3c0b8 commit 69a883d

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/Update/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ int executeCommandLine(string[] args)
122122
UpdateSelf().Wait();
123123
break;
124124
case UpdateAction.Shortcut:
125-
Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon);
125+
Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon, opt.onlyUpdateShortcuts);
126126
break;
127127
case UpdateAction.Deshortcut:
128128
Deshortcut(opt.target, opt.shortcutArgs);
@@ -422,7 +422,7 @@ public void Releasify(string package, string targetDir = null, string packagesDi
422422
}
423423
}
424424

425-
public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon)
425+
public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon, bool onlyUpdate)
426426
{
427427
if (String.IsNullOrWhiteSpace(exeName)) {
428428
ShowHelp();
@@ -434,7 +434,7 @@ public void Shortcut(string exeName, string shortcutArgs, string processStartArg
434434
var locations = parseShortcutLocations(shortcutArgs);
435435

436436
using (var mgr = new UpdateManager("", appName)) {
437-
mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, false, processStartArgs, icon);
437+
mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, onlyUpdate, processStartArgs, icon);
438438
}
439439
}
440440

src/Update/StartupOption.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ internal class StartupOption
2626
internal bool noMsi { get; private set; } = (Environment.OSVersion.Platform != PlatformID.Win32NT); // NB: WiX doesn't work under Mono / Wine
2727
internal bool packageAs64Bit { get; private set; } = false;
2828
internal bool noDelta { get; private set; } = false;
29+
internal bool onlyUpdateShortcuts { get; private set; } = false;
2930

3031
public StartupOption(string[] args) {
3132
optionSet = Parse(args);
@@ -66,6 +67,7 @@ private OptionSet Parse(string[] args) {
6667
{ "no-delta", "Don't generate delta packages to save time", v => noDelta = true},
6768
{ "framework-version=", "Set the required .NET framework version, e.g. net461", v => frameworkVersion = v },
6869
{ "msi-win64", "Mark the MSI as 64-bit, which is useful in Enterprise deployment scenarios", _ => packageAs64Bit = true},
70+
{ "updateOnly", "Update shortcuts that already exist, rather than creating new ones", _ => onlyUpdateShortcuts = true},
6971
};
7072

7173
opts.Parse(args);

0 commit comments

Comments
 (0)