From d947b4feca9bfff19f2c8d256653344752b1c31b Mon Sep 17 00:00:00 2001 From: ci010 Date: Sat, 14 Nov 2020 22:11:14 +0800 Subject: [PATCH] fix: install internal java to wrong position --- src/main/service/JavaService.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/service/JavaService.ts b/src/main/service/JavaService.ts index 01556d0cb..8f121d14d 100644 --- a/src/main/service/JavaService.ts +++ b/src/main/service/JavaService.ts @@ -8,7 +8,7 @@ import { requireString } from '@universal/util/assert'; import { downloadFileTask, JavaInstaller } from '@xmcl/installer'; import { task } from '@xmcl/task'; import { extract } from '@xmcl/unzip'; -import { move, readdir, remove, unlink } from 'fs-extra'; +import { ensureFile, move, readdir, remove, unlink } from 'fs-extra'; import { basename, dirname, join } from 'path'; import Service, { Singleton } from './Service'; @@ -53,14 +53,15 @@ export default class JavaService extends Service { */ @Singleton('java') async installDefaultJava() { - let task = this.networkManager.isInGFW ? this.installFromTsingHuaTask() : this.installFromMojangTask(); - let handle = this.submit(task); + const task = this.networkManager.isInGFW ? this.installFromTsingHuaTask() : this.installFromMojangTask(); + const handle = this.submit(task); + await ensureFile(this.getInternalJavaLocation()); await handle.wait(); await this.resolveJava(this.getInternalJavaLocation()); } private installFromMojangTask() { - let dest = this.getInternalJavaLocation(); + const dest = dirname(this.getInternalJavaLocation()); return JavaInstaller.installJreFromMojangTask({ destination: dest, unpackLZMA: unpack7z,