4
0
mirror of https://github.com/AltarikMC/Launcher synced 2024-11-21 06:09:51 +01:00

Fix a lot of issue on linux

This commit is contained in:
Quentin Legot 2024-02-07 21:34:07 +01:00
parent c0f6ace012
commit 2efc5e28e4

View File

@ -302,7 +302,7 @@ export default class Minecraft {
const infos = this.modsList[chapterId].java.platform[process.platform][process.arch] const infos = this.modsList[chapterId].java.platform[process.platform][process.arch]
const jre = join(runtime, infos.name) const jre = join(runtime, infos.name)
const downloadFolder = join(runtime, 'download') const downloadFolder = join(runtime, 'download')
const downloadFile = join(downloadFolder, `${infos.name}.zip`) const downloadFile = join(downloadFolder, `${infos.name}${process.platform === 'win32' ? '.zip' : '.tar.gz'}`)
if (fs.existsSync(jre)) { fs.rmSync(jre, { recursive: true }) } if (fs.existsSync(jre)) { fs.rmSync(jre, { recursive: true }) }
if (!fs.existsSync(downloadFolder)) { fs.mkdirSync(downloadFolder, { recursive: true }) } if (!fs.existsSync(downloadFolder)) { fs.mkdirSync(downloadFolder, { recursive: true }) }
if (fs.existsSync(downloadFile)) { if (fs.existsSync(downloadFile)) {
@ -334,18 +334,18 @@ export default class Minecraft {
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}`) logger.info(`Downloading ${infos.name}`)
this.downloadMods(infos.link, join(downloadFolder, `${infos.name}.zip`)).then(() => { this.downloadMods(infos.link, join(downloadFolder, `${infos.name}${process.platform === 'win32' ? '.zip' : '.tar.gz'}`)).then(() => {
logger.info('download completed') logger.info('download completed')
this.extractJavaArchive(join(downloadFolder, `${infos.name}.zip`), runtimeFolder).then(() => { this.extractJavaArchive(join(downloadFolder, `${infos.name}${process.platform === 'win32' ? '.zip' : '.tar.gz'}`), runtimeFolder).then(() => {
logger.info('File unzipped') logger.info('File unzipped')
resolve() resolve()
}).catch(err => { }).catch(err => {
const joinS = join(downloadFolder, `${infos.name}.zip`) const joinS = join(downloadFolder, `${infos.name}${process.platform === 'win32' ? '.zip' : '.tar.gz'}`)
logger.info(`Failed to unzip ${joinS}`) logger.error(`Failed to unzip ${joinS}`)
reject(err) reject(err)
}) })
}).catch(err => { }).catch(err => {
logger.err(`Failed to download ${infos.link} to ${infos.name}.zip`) logger.err(`Failed to download ${infos.link} to ${infos.name}${process.platform === 'win32' ? '.zip' : '.tar.gz'}`)
reject(err) reject(err)
}) })
}) })