Skip to content

Commit 0b8c4e3

Browse files
committed
Detached Minecraft from the Launcher
1 parent 2418784 commit 0b8c4e3

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplelauncher",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "Launcher for SimpleClient",
55
"main": "src/main.js",
66
"scripts": {
@@ -32,7 +32,7 @@
3232
"build": {
3333
"appId": "simpleclient.simplelauncher",
3434
"productName": "SimpleLauncher",
35-
"artifactName": "SimpleClient-Installer.${ext}",
35+
"artifactName": "SimpleClient-${version}.${ext}",
3636
"icon": "src/gui/icon.ico",
3737
"win": {
3838
"target": "msi"

src/minecraft.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,20 @@ const launch = async (version, account, statusCallback) => {
242242
if (existsSync(join(getDirectory(), 'tmpmods'))) rmSync(join(getDirectory(), 'tmpmods'), {recursive: true, force: true})
243243
cpSync(join(getMinecraftDir(), 'mods'), join(getDirectory(), 'tmpmods'), {recursive: true, force: true})
244244
rmSync(join(getMinecraftDir(), 'mods'), {recursive: true, force: true})
245-
spawn('java', insertValues(arguments, values), {
245+
console.log('[Minecraft] Launching...')
246+
const process = spawn('java', insertValues(arguments, values), {
246247
cwd: getMinecraftDir(),
247-
env: {PATH: path}
248-
}).stdout.on('data', data => {
248+
env: {PATH: path},
249+
detached: true
250+
})
251+
process.stdout.on('data', data => {
249252
if (data.toString().includes('Loading ') &&
250253
data.toString().includes(' mods:')) {
251-
cp(join(getDirectory(), 'tmpmods'), join(getMinecraftDir(), 'mods'), {recursive: true, force: true}, () => {})
254+
cpSync(join(getDirectory(), 'tmpmods'), join(getMinecraftDir(), 'mods'), {recursive: true, force: true})
252255
rm(join(getDirectory(), 'tmpmods'), {recursive: true, force: true}, () => {})
253256
}
254257
}).pipe(stdout)
258+
process.unref()
255259
statusCallback('done')
256260
}
257261

0 commit comments

Comments
 (0)