在行GitHub, Inc.
上创建快捷方式时,我无法理解squirell安装程序在哪里获得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)
我的build.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;
}
};
答案 0 :(得分:0)
似乎创建快捷方式的“组名”取决于电子包装商提供的元数据公司名称值。电子包装机的另一个参数解决了该问题:
'--win32metadata.CompanyName="My Company" '