4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-22 06:19:50 +01:00

Added log messages

This commit is contained in:
Quentin Legot 2021-10-06 13:27:56 +02:00
parent c33f8683f0
commit de4b155079
2 changed files with 14 additions and 3 deletions

View File

@ -20,7 +20,7 @@
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"scripts": { "scripts": {
"start": "electron-forge start", "start": "electron-forge start",
"test": "electron .", "test": "electron . --inspect",
"package": "electron-forge package", "package": "electron-forge package",
"make": "electron-forge make" "make": "electron-forge make"
}, },

View File

@ -246,9 +246,11 @@ class Minecraft {
async unzipMods(zipLocation, outLocation=this.minecraftpath) { async unzipMods(zipLocation, outLocation=this.minecraftpath) {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
logger.info(`unzipping ${zipLocation} file to ${outLocation}`)
zip(zipLocation, { dir: outLocation }).then(() => { zip(zipLocation, { dir: outLocation }).then(() => {
resolve() resolve()
}).catch(err => { }).catch(err => {
logger.err(`failed to unzip file`)
reject(err) reject(err)
}) })
@ -298,16 +300,25 @@ class Minecraft {
} }
event.sender.send("progress", {type: "java", task: 1, total: 1 }) event.sender.send("progress", {type: "java", task: 1, total: 1 })
} else { } else {
reject("There is not available version for your system") reject("There is not available version for this system")
} }
}) })
} }
async downloadAndExtractJava(infos, downloadFolder, runtimeFolder) { async downloadAndExtractJava(infos, downloadFolder, runtimeFolder) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
logger.info(`Downloading ${infos.name}`)
this.downloadMods(infos.link, join(downloadFolder, `${infos.name}.zip`)).then(() => { this.downloadMods(infos.link, join(downloadFolder, `${infos.name}.zip`)).then(() => {
this.unzipMods(join(downloadFolder, `${infos.name}.zip`), runtimeFolder).then(() => resolve()).catch(err => reject(err)) logger.info(`download completed`)
this.unzipMods(join(downloadFolder, `${infos.name}.zip`), runtimeFolder).then(() => {
logger.info(`File unzipped`)
resolve()
}).catch(err => {
logger.info(`Failed to unzip ${join(downloadFolder, `${infos.name}.zip`)}`)
reject(err)
})
}).catch(err => { }).catch(err => {
logger.err(`Download failed`)
reject(err) reject(err)
}) })
}) })