1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-09-27 03:53:00 +02:00

Fix linux not creating the autostart dir if not exist

This commit is contained in:
Hinton 2020-11-27 11:34:09 +01:00
parent 75d26de581
commit 0cd196f56c

View File

@ -17,7 +17,9 @@ export class MessagingMain {
init() {
this.scheduleNextSync();
if (process.platform !== 'linux') {
if (process.platform === 'linux') {
this.storageService.save(ElectronConstants.openAtLogin, fs.existsSync(this.linuxStartupFile()));
} else {
const loginSettings = app.getLoginItemSettings();
this.storageService.save(ElectronConstants.openAtLogin, loginSettings.openAtLogin);
}
@ -98,6 +100,10 @@ export class MessagingMain {
StartupNotify=false
Terminal=false`;
const dir = path.dirname(this.linuxStartupFile());
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
fs.writeFileSync(this.linuxStartupFile(), data);
} else {
app.setLoginItemSettings({openAtLogin: true});
@ -106,9 +112,8 @@ export class MessagingMain {
private removeOpenAtLogin() {
if (process.platform === 'linux') {
const file = this.linuxStartupFile();
if (fs.existsSync(file)) {
fs.unlinkSync(file);
if (fs.existsSync(this.linuxStartupFile())) {
fs.unlinkSync(this.linuxStartupFile());
}
} else {
app.setLoginItemSettings({openAtLogin: false});