Skip to content

Commit 1a48697

Browse files
committed
Fix error boxes locking client
1 parent cf9a0f3 commit 1a48697

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

index.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ const os = require("os")
1313
const Config = require('electron-config');
1414
const config = new Config();
1515

16+
// solve problems with error boxes
17+
// Disable error dialogs by overriding
18+
// FIX: https://goo.gl/YsDdsS
19+
dialog.showErrorBox = function(title, content) {
20+
console.log(`${title}\n${content}`);
21+
};
22+
1623
// Keep a global reference of the window object, if you don't, the window will
1724
// be closed automatically when the JavaScript object is garbage collected.
1825
let win
@@ -87,7 +94,7 @@ app.on("ready", function() { // run main app code
8794

8895
// manage and download mods, then launch factorio with a server IP
8996
ipc.on("launchFactorio", function(event, data){
90-
console.log("Preparing to launch factorio with "+data.ip+":"+data.port)
97+
console.vlog("Preparing to launch factorio with "+data.ip+":"+data.port)
9198
console.log(data.mods)
9299

93100
// check if you chose the correct factorio directory
@@ -117,8 +124,7 @@ app.on("ready", function() { // run main app code
117124
// and rcon connects even when it doesn't manage to authenticate
118125
timeout: 10, // timeout is an advantage when we only want to check if its up, if it hasn't answered in 10s its probably not there anyways
119126
});
120-
// start connection
121-
client.connect();
127+
122128

123129
// when connected disconnect
124130
client.on('connected', function () {
@@ -167,11 +173,13 @@ app.on("ready", function() { // run main app code
167173
}
168174
}
169175

170-
// this causes error write_after_end, and it is kinda important but I have to leave it out
171-
//client.close(); // disconnect once we have connected because we are not actually going to rcon anything
176+
// this causes error write_after_end, and it is kinda important but I have to leave it out (nope?)
177+
client.close(); // disconnect once we have connected because we are not actually going to rcon anything
172178
}).on('disconnected', function () {
173179

174180
});
181+
// start connection
182+
client.connect();
175183
});
176184

177185
ipc.on("tick", function(event, data) {

0 commit comments

Comments
 (0)