[AutoStart > Linux] Minor source cleanup

This commit is contained in:
Ducko 2022-04-22 18:35:57 +01:00
parent b51d358492
commit 933377e49d
1 changed files with 10 additions and 11 deletions

View File

@ -8,31 +8,30 @@ const buildInfo = require('../utils/buildInfo');
const desktopPath = join(app.getPath('appData'), 'autostart', app.name + '-' + buildInfo.releaseChannel + '.desktop'); const desktopPath = join(app.getPath('appData'), 'autostart', app.name + '-' + buildInfo.releaseChannel + '.desktop');
// Vars for use in desktop file content template // Vars for use in desktop file content template
const exePath = app.getPath('exe'); const exec = app.getPath('exe');
// Template for desktop file // Template for desktop file
const desktopContent = `[Desktop Entry] const desktopContent = `[Desktop Entry]
Type=Application Type=Application
Exec=${exePath} Exec=${exec}
Hidden=false Hidden=false
NoDisplay=false NoDisplay=false
Name=${basename(process.execPath)} Name=${basename(process.execPath)}
Icon=${join(global.systemElectron ? '/usr/share/pixmaps/Discord' : dirname(exePath), 'discord.png')} Icon=${join(global.systemElectron ? '/usr/share/pixmaps/Discord' : dirname(exec), 'discord.png')}
Comment=Text and voice chat for gamers. Comment=Text and voice chat for gamers.
X-GNOME-Autostart-enabled=true`; X-GNOME-Autostart-enabled=true`;
exports.install = (callback) => { exports.install = (cb) => {
try { try {
mkdirp.sync(dirname(desktopPath)); mkdirp.sync(dirname(desktopPath));
return fs.writeFile(desktopPath, desktopContent, callback); return fs.writeFile(desktopPath, desktopContent, cb);
} catch (e) { } catch {
log('AutoStart', e); return cb(); // Callback anyway
return callback(); // Callback anyway
} }
}; };
exports.update = (callback) => callback(); exports.update = (cb) => cb();
exports.uninstall = (callback) => fs.unlink(desktopPath, callback); exports.uninstall = (cb) => fs.unlink(desktopPath, cb);
exports.isInstalled = (callback) => fs.access(desktopPath, fs.constants.F_OK, callback); exports.isInstalled = (cb) => fs.access(desktopPath, fs.constants.F_OK, cb);