nixpkgs/pkgs/by-name/vo/voicevox/hardcode-paths.patch
2025-07-03 15:54:11 +02:00

63 lines
2.2 KiB
Diff

diff --git a/.env.production b/.env.production
index cc5e2b9..29140f8 100644
--- a/.env.production
+++ b/.env.production
@@ -4,7 +4,7 @@ VITE_DEFAULT_ENGINE_INFOS=`[
"uuid": "074fc39e-678b-4c13-8916-ffca8d505d1d",
"name": "VOICEVOX Engine",
"executionEnabled": true,
- "executionFilePath": "vv-engine/run.exe",
+ "executionFilePath": "@voicevox_engine_path@",
"executionArgs": [],
"host": "http://127.0.0.1:50021"
}
diff --git a/electron-builder.config.cjs b/electron-builder.config.cjs
index d2a21b4..7b338c0 100644
--- a/electron-builder.config.cjs
+++ b/electron-builder.config.cjs
@@ -40,17 +40,6 @@ const isArm64 = process.arch === "arm64";
// cf: https://k-hyoda.hatenablog.com/entry/2021/10/23/000349#%E8%BF%BD%E5%8A%A0%E5%B1%95%E9%96%8B%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%85%88%E3%81%AE%E8%A8%AD%E5%AE%9A
const extraFilePrefix = isMac ? "MacOS/" : "";
-const sevenZipFile = readdirSync(resolve(__dirname, "vendored", "7z")).find(
- // Windows: 7za.exe, Linux: 7zzs, macOS: 7zz
- (fileName) => ["7za.exe", "7zzs", "7zz"].includes(fileName),
-);
-
-if (!sevenZipFile) {
- throw new Error(
- "7z binary file not found. Run `node ./tools/download7z.ts` first.",
- );
-}
-
/** @type {import("electron-builder").Configuration} */
const builderOptions = {
beforeBuild: async () => {
@@ -91,14 +80,6 @@ const builderOptions = {
from: "build/README.txt",
to: extraFilePrefix + "README.txt",
},
- {
- from: VOICEVOX_ENGINE_DIR,
- to: join(extraFilePrefix, "vv-engine"),
- },
- {
- from: resolve(__dirname, "vendored", "7z", sevenZipFile),
- to: extraFilePrefix + sevenZipFile,
- },
],
// electron-builder installer
productName: "VOICEVOX",
diff --git a/src/backend/electron/vvppFile.ts b/src/backend/electron/vvppFile.ts
index 7e152f1..1aaa8c4 100644
--- a/src/backend/electron/vvppFile.ts
+++ b/src/backend/electron/vvppFile.ts
@@ -220,6 +220,7 @@ export class VvppFileExtractor {
}
private getSevenZipPath(): string {
+ return "@sevenzip_path@";
let sevenZipPath = import.meta.env.VITE_7Z_BIN_NAME;
if (!sevenZipPath) {
throw new Error("7z path is not defined");