Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

マルチエンジン:ZIP64の展開を修正 #1162

Merged
merged 5 commits into from
Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"source-map-support": "0.5.19",
"systeminformation": "5.8.0",
"tree-kill": "1.2.2",
"unzipper": "0.10.11",
"unzipper": "github:ZJONSSON/node-unzipper#341f258",
"uuid": "9.0.0",
"vue": "3.2.45",
"vue-router": "4.0.8",
Expand Down
47 changes: 30 additions & 17 deletions src/background/vvppManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fs from "fs";
import path from "path";
import log from "electron-log";
import { moveFile } from "move-file";
// FIXME: 正式版が出たら切り替える。https://github.com/VOICEVOX/voicevox_project/issues/2#issuecomment-1401721286
import { Extract } from "unzipper";
import { dialog } from "electron";
import {
Expand Down Expand Up @@ -146,24 +147,36 @@ export class VvppManager {
}

log.log("Extracting vvpp to", outputDir);
await new Promise((resolve, reject) => {
new MultiStream(streams)
.pipe(Extract({ path: outputDir }))
.on("close", resolve)
.on("error", reject);
});
const manifest: MinimumEngineManifest = minimumEngineManifestSchema.parse(
JSON.parse(
await fs.promises.readFile(
path.join(outputDir, "engine_manifest.json"),
"utf-8"
try {
await new Promise((resolve, reject) => {
new MultiStream(streams)
.pipe(Extract({ path: outputDir }))
.on("close", resolve)
.on("error", reject);
});
const manifest: MinimumEngineManifest = minimumEngineManifestSchema.parse(
JSON.parse(
await fs.promises.readFile(
path.join(outputDir, "engine_manifest.json"),
"utf-8"
)
)
)
);
return {
outputDir,
manifest,
};
);
return {
outputDir,
manifest,
};
} catch (e) {
if (fs.existsSync(outputDir)) {
log.log("Failed to extract vvpp, removing", outputDir);
await fs.promises.rm(outputDir, { recursive: true });
}
throw e;
} finally {
for (const stream of streams) {
stream.close();
}
}
}

async install(vvppPath: string) {
Expand Down