Squirrel.Windows icon indicating copy to clipboard operation
Squirrel.Windows copied to clipboard

How can I use UpdateManager.CreateShortcutsForExecutable with onlyUpdate = true

Open shimika opened this issue 7 years ago • 2 comments

I want to approach onlyUpdate to true by call update.exe but it seems no method.

There is only

mgr.CreateShortcutsForExecutable(exeName, locations ?? defaultLocations, false, processStartArgs, icon);

maybe

shimika avatar Jun 07 '17 09:06 shimika

@shimika There is a comment in the code explaining the behavior of this flag when used with CreateShortcutsForExecutable: https://github.com/Squirrel/Squirrel.Windows/blob/de5baa93a134ac24fd5bf9172d3e457ac27e0b7a/src/Squirrel/UpdateManager.ApplyReleases.cs#L214

                    // NB: If we've already installed the app, but the shortcut
                    // is no longer there, we have to assume that the user didn't
                    // want it there and explicitly deleted it, so we shouldn't
                    // annoy them by recreating it.

Does it clarify the intent of this flag?

Thieum avatar May 02 '19 14:05 Thieum

I have a similar desire as the OP here.

I'm trying to update the shortcuts for a project installed by squirrel, and I'd like to leverage this option for CreateShortcutsForExecutable to only update the shortcuts (so we don't end up recreating shortcuts after the user has deleted them). Currently we execute squirrel with --createShortcut= to generate the shortcuts in the start menu and desktop. Unfortunately though without making additional changes, this means we end up recreating the shortcuts even if a user deletes them.

Would it be reasonable to expose this option under the --createShortcut= flag somehow? Possible as an additional flag --only-update following it? I'd like to avoid recreating the same logic in my own update code if I can build on what already exists in squirrel.

vidia avatar Oct 14 '20 23:10 vidia