[AutoStart > win32] Minor source cleanup
This commit is contained in:
parent
133cf280e4
commit
b067853371
1 changed files with 4 additions and 6 deletions
|
@ -3,16 +3,14 @@ const { join, basename, dirname } = require('path');
|
||||||
const registry = require('../utils/registry');
|
const registry = require('../utils/registry');
|
||||||
|
|
||||||
const appName = basename(process.execPath, '.exe');
|
const appName = basename(process.execPath, '.exe');
|
||||||
const fullExeName = basename(process.execPath);
|
|
||||||
const updatePath = join(dirname(process.execPath), '..', 'Update.exe');
|
|
||||||
|
|
||||||
const queuePrefix = [ 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName ];
|
const queuePrefix = [ 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run', '/v', appName ];
|
||||||
|
|
||||||
exports.install = (callback) => {
|
exports.install = (callback) => {
|
||||||
log('AutoStart', 'Install');
|
log('AutoStart', 'Install');
|
||||||
|
|
||||||
const execPath = `${updatePath} --processStart ${fullExeName}` + (settings.get('START_MINIMIZED', false) ? ' --process-start-args --start-minimized' : ''); // Add Electron args if start minimized on
|
const execPath = join(dirname(process.execPath), '..', 'Update.exe') + ` --processStart ${basename(process.execPath)}` + (settings.get('START_MINIMIZED', false) ? ' --process-start-args --start-minimized' : ''); // Add Electron args if start minimized on
|
||||||
registry.add([[...queuePrefix, '/d', execPath]], callback); // Make reg
|
registry.add([[ ...queuePrefix, '/d', execPath ]], callback); // Make reg
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.update = (callback) => {
|
exports.update = (callback) => {
|
||||||
|
@ -24,7 +22,7 @@ exports.update = (callback) => {
|
||||||
exports.uninstall = (callback) => {
|
exports.uninstall = (callback) => {
|
||||||
log('AutoStart', 'Uninstall');
|
log('AutoStart', 'Uninstall');
|
||||||
|
|
||||||
registry.spawn(['delete', ...queuePrefix, '/f'], (_error, _stdout) => callback()); // Delete reg
|
registry.spawn([ 'delete', ...queuePrefix, '/f' ], (_error, _stdout) => callback()); // Delete reg
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.isInstalled = (callback) => registry.spawn(['query', ...queuePrefix], (_error, stdout) => callback(stdout.includes(appName))); // Check reg
|
exports.isInstalled = (callback) => registry.spawn([ 'query', ...queuePrefix ], (_error, stdout) => callback(stdout.includes(appName))); // Check reg
|
Loading…
Reference in a new issue