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

Added CLI flag to onlyUpdate shortcuts #1674

Merged
merged 1 commit into from
Oct 31, 2020
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
6 changes: 3 additions & 3 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ int executeCommandLine(string[] args)
UpdateSelf().Wait();
break;
case UpdateAction.Shortcut:
Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon);
Shortcut(opt.target, opt.shortcutArgs, opt.processStartArgs, opt.setupIcon, opt.onlyUpdateShortcuts);
break;
case UpdateAction.Deshortcut:
Deshortcut(opt.target, opt.shortcutArgs);
Expand Down Expand Up @@ -422,7 +422,7 @@ public void Releasify(string package, string targetDir = null, string packagesDi
}
}

public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon)
public void Shortcut(string exeName, string shortcutArgs, string processStartArgs, string icon, bool onlyUpdate)
{
if (String.IsNullOrWhiteSpace(exeName)) {
ShowHelp();
Expand All @@ -434,7 +434,7 @@ public void Shortcut(string exeName, string shortcutArgs, string processStartArg
var locations = parseShortcutLocations(shortcutArgs);

using (var mgr = new UpdateManager("", appName)) {
mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, false, processStartArgs, icon);
mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, onlyUpdate, processStartArgs, icon);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/Update/StartupOption.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ internal class StartupOption
internal bool noMsi { get; private set; } = (Environment.OSVersion.Platform != PlatformID.Win32NT); // NB: WiX doesn't work under Mono / Wine
internal bool packageAs64Bit { get; private set; } = false;
internal bool noDelta { get; private set; } = false;
internal bool onlyUpdateShortcuts { get; private set; } = false;

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

opts.Parse(args);
Expand Down