Skip to content

Commit eaa3d11

Browse files
committed
Fixed Auto Updater
1 parent ff58d7c commit eaa3d11

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplelauncher",
3-
"version": "0.1.10",
3+
"version": "0.1.11",
44
"description": "Launcher for SimpleClient",
55
"main": "src/main.js",
66
"scripts": {
@@ -21,7 +21,6 @@
2121
"dependencies": {
2222
"app-root-path": "^3.1.0",
2323
"child_process": "^1.0.2",
24-
"dialog-node": "^0.2.1",
2524
"electron-is-dev": "^2.0.0",
2625
"os": "^0.1.2",
2726
"path": "^0.12.7"

src/main.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@ const electronIsDev = require('electron-is-dev');
66
const { getSimpleClientVersions, launch } = require('./minecraft');
77
const { openAuthWindow, getAccounts } = require('./auth');
88
const { checkForUpdates, update } = require('./updater');
9+
const { spawn } = require('child_process');
10+
const { join } = require('path');
11+
const { path } = require('app-root-path');
912

1013
if (!electronIsDev) {
1114
checkForUpdates(async () => {
12-
require('dialog-node').question('An update for SimpleLauncher is available.\nShould it be downloaded in the background?', 'SimpleLauncher', 0, (code, value, stderr) => {
13-
if (value == 'OK') update()
14-
})
15+
if (platform() == 'win32') {
16+
spawn('cscript', [
17+
'//nologo',
18+
join(path, 'src', 'yesno.vbs'),
19+
'SimpleClient',
20+
'An update for SimpleLauncher is available.\nShould it be downloaded in the background?'
21+
]).stdout.on('data', data => {if (data.toString().includes('6')) update()})
22+
}
1523
})
1624
}
1725

src/yesno.vbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Set objArgs = WScript.Arguments
2+
WScript.StdOut.WriteLine MsgBox(objArgs(1), vbYesNo OR vbQuestion, objArgs(0))

0 commit comments

Comments
 (0)