Skip to content

Commit 9344af7

Browse files
committed
Fixed Mod Folder copying
1 parent 2a1727e commit 9344af7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simplelauncher",
3-
"version": "0.3.11",
3+
"version": "0.3.12",
44
"description": "Launcher for SimpleClient",
55
"main": "src/main.js",
66
"scripts": {

src/minecraft.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { getDirectory, getMinecraftDir } = require("./util")
22
const { join } = require("path")
33
const { spawn, } = require("child_process")
4-
const { readFileSync, rmSync, cpSync, readdirSync } = require("fs")
4+
const { readFileSync, rmSync, cpSync, readdirSync, existsSync } = require("fs")
55
const { platform } = require("os")
66
const { arch, env, stdout } = require("process")
77
const { downloadMeta } = require("./download/metadownloader")
@@ -188,7 +188,7 @@ const launch = (version, account, statusCallback) => {
188188
} else arguments.push(arg)
189189
})
190190
rmSync(join(getDirectory(), 'tmpmods'), {recursive: true, force: true})
191-
cpSync(join(dir, 'mods'), join(getDirectory(), 'tmpmods'), {recursive: true, force: true})
191+
if (existsSync(join(dir, 'mods'))) cpSync(join(dir, 'mods'), join(getDirectory(), 'tmpmods'), {recursive: true, force: true})
192192
rmSync(join(dir, 'mods'), {recursive: true, force: true})
193193
log('Launching...')
194194
const process = spawn(join(getJavaPath(meta.javaVersion.component), 'bin', 'javaw'), insertValues(arguments, values), {
@@ -198,7 +198,7 @@ const launch = (version, account, statusCallback) => {
198198
})
199199
process.stdout.on('data', data => {
200200
if (data.toString().includes('Loading ') && data.toString().includes(' mods:')) {
201-
cpSync(join(getDirectory(), 'tmpmods'), join(dir, 'mods'), {recursive: true, force: true})
201+
if (existsSync(join(getDirectory(), 'tmpmods'))) cpSync(join(getDirectory(), 'tmpmods'), join(dir, 'mods'), {recursive: true, force: true})
202202
}
203203
}).pipe(stdout)
204204
process.unref()

0 commit comments

Comments
 (0)