[AutoStart > win32] Minor source cleanup

This commit is contained in:
Ducko 2022-04-05 14:13:31 +01:00
parent 133cf280e4
commit b067853371
1 changed files with 4 additions and 6 deletions

View File

@ -3,16 +3,14 @@ const { join, basename, dirname } = require('path');
const registry = require('../utils/registry');
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 ];
exports.install = (callback) => {
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
registry.add([[...queuePrefix, '/d', execPath]], callback); // Make reg
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
};
exports.update = (callback) => {
@ -24,7 +22,7 @@ exports.update = (callback) => {
exports.uninstall = (callback) => {
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