Skip to content

Commit

Permalink
fix: install internal java to wrong position
Browse files Browse the repository at this point in the history
  • Loading branch information
ci010 committed Nov 14, 2020
1 parent ae809eb commit d947b4f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/service/JavaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit d947b4f

Please sign in to comment.