Answering one shutdown popup closes them all

This commit is contained in:
Atlante45 2016-01-22 17:18:08 -08:00
parent 6cd6c3038f
commit d159f8dc38

View file

@ -105,19 +105,23 @@ const ipcMain = electron.ipcMain;
var isShuttingDown = false;
function shutdown() {
if (!isShuttingDown) {
var idx = 0;
// if the home server is running, show a prompt before quit to ask if the user is sure
if (homeServer.state == ProcessGroupStates.STARTED) {
idx = dialog.showMessageBox({
dialog.showMessageBox({
type: 'question',
buttons: ['Yes', 'No'],
title: 'Are you sure?',
message: 'Quitting will stop your Server Console and your Home domain will no longer be running.'
});
}, shutdownCallback);
} else {
shutdownCallback(0);
}
if (idx == 0) {
}
}
function shutdownCallback(idx) {
if (idx == 0 && !isShuttingDown) {
isShuttingDown = true;
userConfig.save(configPath);
@ -147,7 +151,6 @@ function shutdown() {
}
}
}
}
function deleteOldFiles(directoryPath, maxAgeInSeconds, filenameRegex) {
console.log("Deleting old log files in " + directoryPath);