3

I have an electron application for which I use electron-packager to compile and grunt-electron-installer to generate the Windows installer package.

Upon installation I handle the squirrel events like so:

//...

  switch (squirrelCommand) {
      case '--squirrel-install':
      case '--squirrel-updated':
        createShortcuts(cleanUp);
        break;
//...

and the createShortcuts function just spawns a child process to call the Update.exe (Squirrel.exe) with the --createShortcut=myapp.exe arguments

This works, however, when the shortcut it generated it is named Electron instead of myapp.

I don't see any other ways to specify the output name of the shortcut, so how would I change the generated shortcut to say myapp?

Here is the snippet of the squirrel logs:

2016-03-20 10:34:35> ApplyReleasesImpl: Creating shortcut for myapp.exe => C:\Users\zeus\Desktop\Electron.lnk
2016-03-20 10:34:35> ApplyReleasesImpl: About to save shortcut: C:\Users\zeus\Desktop\Electron.lnk (target C:\Users\zeus\AppData\Local\myapp\Update.exe, workingDir C:\Users\zeus\AppData\Local\myapp\app-0.0.3, args --processStart myapp.exe)
tt9
  • 5,784
  • 6
  • 42
  • 65

3 Answers3

2

Upon further investigation into electron-packager I found a more detailed explanation about the resource editing here.

using the electron-packager command line I pass these arguments to update the embedded electron exe information:

electron-packager ... --version-string.CompanyName="Company Inc." --version-string.ProductName="Product" ...

The grunt-electron-installer will look for this embedded application information to generate the name for the shortcut.

tt9
  • 5,784
  • 6
  • 42
  • 65
2

If you use electron-forge, you may want to try a config that looks like this:

"electronPackagerConfig": {
  "icon": "Icon",
  "win32metadata":{
    "ProductName": "My App",
    "CompanyName": "My Company"
  }
}

More info here: https://github.com/electron-userland/electron-forge/issues/89

depsypher
  • 1,084
  • 11
  • 20
0

Try to use electron-builder if you get painful with Squirrel. You can use the command as below to make your installer for Windows: electron-builder path/to/your-electron-packager-output --platform=win --out=path/to/your-installer-output --config=path/to/builder.json --target=win

Sample content for builder.json:

{ "win": { "title": "My Production Name", "icon": "path/to/your-icon.ico", "version": "1.0.0", "publisher": "Your Company Name" } }

P.s: You must install NSIS and add NSIS path into PATH environment before you run the above command.

phuongle
  • 1,166
  • 11
  • 17