fix: #42 revamped start on boot as it was still causing error for some users.

This commit is contained in:
Quentin “Storm1er” Decaunes 2019-08-14 17:18:21 +02:00
parent 27b835c2c2
commit 9d01b070d3

View File

@ -630,14 +630,16 @@ function updateScheduledStartOnBoot(toBeEnabled) {
});
autoLaunch.isEnabled().then((isEnabled) => {
console.log(`toBeEnabled: ${toBeEnabled} isEnabled: ${isEnabled}`);
if (toBeEnabled && !isEnabled) {
autoLaunch.enable();
} else {
try {
if (isEnabled) {
autoLaunch.disable();
} catch (error) {
console.log("WARNING: Unable to disable start on boot. Is autoLaunch already disabled?", error);
}
if (toBeEnabled) {
autoLaunch.enable();
}
} catch (error) {
console.log("WARNING: Unable to manage start on boot.", error);
}
});
}