электронный winstaller создает ярлык в неправильной группе - PullRequest
0 голосов
/ 22 февраля 2020

Я не могу понять, откуда установщик squirell получает значение GitHub, Inc. при создании ярлыка в строке ApplyReleasesImpl: Creating shortcut?

SquirrelSetup.log:

 Program: Starting Squirrel Updater: --createShortcut Arefsotil.exe
 ApplyReleasesImpl: About to create shortcuts for Arefsotil.exe, rootAppDir C:\Users\xxx\AppData\Local\Arefsotil
 ApplyReleasesImpl: Creating shortcut for Arefsotil.exe => C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc.\Arefsotil.lnk
 ApplyReleasesImpl: About to save shortcut: C:\Users\xxx\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\GitHub, Inc.\Arefsotil.lnk (target C:\Users\xxx\AppData\Local\Arefsotil\Arefsotil.exe, workingDir C:\Users\xxx\AppData\Local\Arefsotil\app-1.0.0, args , toastActivatorCSLID 72b097c7-3197-528e-bad0-3a09c24db577)

моей сборки. js - это:

var electronInstaller = require('electron-winstaller');

// In this case, we can use relative paths
var settings = {
    // Specify the folder where the built app is located
    appDirectory: '../build/bundle/Arefsotil-win32-x64',
    // Specify the existing folder where
    outputDirectory: '../build/installers',
    // The name of the Author of the app (the name of your company)
    authors: 'Our Code World Inc.',
    // The name of the executable of your built
    exe: './Arefsotil.exe',
    title: 'Arefsotil'
};

resultPromise = electronInstaller.createWindowsInstaller(settings);

 resultPromise.then(() => {
     console.log("The installers of your application were succesfully created !");
 }, (e) => {
     console.log(`Well, sometimes you are not so lucky: ${e.message}`)
 });

и мои app.js события сквирла:

// this should be placed at top of main.js to handle setup events quickly
if (handleSquirrelEvent(app)) {
  // squirrel event handled and app will exit in 1000ms, so don't do anything else
  return;
}

function handleSquirrelEvent(application) {
  if (process.argv.length === 1) {
    return false;
  }

  const ChildProcess = require('child_process');
  const path = require('path');

  const appFolder = path.resolve(process.execPath, '..');
  const rootAtomFolder = path.resolve(appFolder, '..');
  const updateDotExe = path.resolve(path.join(rootAtomFolder, 'Update.exe'));
  const exeName = path.basename(process.execPath);

  const spawn = function(command, args) {
    let spawnedProcess, error;

    try {
      spawnedProcess = ChildProcess.spawn(command, args, {detached: true});
    } catch (error) {}

    return spawnedProcess;
  };

  const spawnUpdate = function(args) {
    return spawn(updateDotExe, args);
  };

  const squirrelEvent = process.argv[1];
  switch (squirrelEvent) {
    case '--squirrel-install':
    case '--squirrel-updated':
      // Optionally do things such as:
      // - Add your .exe to the PATH
      // - Write to the registry for things like file associations and
      //   explorer context menus

      // Install desktop and start menu shortcuts
      spawnUpdate(['--createShortcut', exeName]);

      setTimeout(application.quit, 1000);
      return true;

    case '--squirrel-uninstall':
      // Undo anything you did in the --squirrel-install and
      // --squirrel-updated handlers

      // Remove desktop and start menu shortcuts
      spawnUpdate(['--removeShortcut', exeName]);

      setTimeout(application.quit, 1000);
      return true;

    case '--squirrel-obsolete':
      // This is called on the outgoing version of your app before
      // we update to the new version - it's the opposite of
      // --squirrel-updated

      application.quit();
      return true;
  }
};

1 Ответ

0 голосов
/ 24 февраля 2020

Похоже, что имя группы, в которой создается ярлык, зависит от значения названия компании, предоставленного электронным упаковщиком метаданных. Дополнительный параметр к электронному упаковщику исправил проблему:

'--win32metadata.CompanyName="My Company" '

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...