From 166ea3d1d9d0a7d82bc397e361c8f46ac2334832 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:08:10 +0900 Subject: [PATCH 01/10] =?UTF-8?q?refactor:=20=E3=82=A8=E3=83=B3=E3=82=B8?= =?UTF-8?q?=E3=83=B3=E6=83=85=E5=A0=B1=E7=AE=A1=E7=90=86=E3=81=AE=E3=83=AD?= =?UTF-8?q?=E3=82=B8=E3=83=83=E3=82=AF=E3=82=92=E6=94=B9=E5=96=84=E3=81=97?= =?UTF-8?q?=E3=80=81=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3=E6=83=85=E5=A0=B1?= =?UTF-8?q?=E3=81=AE=E5=8F=96=E5=BE=97=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89?= =?UTF-8?q?=E3=82=92=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../electron/manager/engineInfoManager.ts | 178 +++++++++++------- 1 file changed, 105 insertions(+), 73 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 83308f0844..17a41a0ff3 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -15,35 +15,11 @@ import { minimumEngineManifestSchema, } from "@/type/preload"; import { AltPortInfos } from "@/store/type"; +import { UnreachableError } from "@/type/utility"; import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo"; +import { failure, Result, success } from "@/type/result"; -/** - * デフォルトエンジンの情報を取得する - */ -function fetchDefaultEngineInfos(defaultEngineDir: string): EngineInfo[] { - // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする - const engines = loadEnvEngineInfos(); - - return engines.map((engineInfo) => { - const { protocol, hostname, port, pathname } = new URL(engineInfo.host); - return { - ...engineInfo, - protocol, - hostname, - defaultPort: port, - pathname: pathname === "/" ? "" : pathname, - isDefault: true, - type: "path", - executionFilePath: path.resolve(engineInfo.executionFilePath), - path: - engineInfo.path == undefined - ? undefined - : path.resolve(defaultEngineDir, engineInfo.path), - } satisfies EngineInfo; - }); -} - -/** エンジンの情報を管理するクラス */ +/** 利用可能なエンジンの情報を管理するクラス */ export class EngineInfoManager { defaultEngineDir: string; vvppEngineDir: string; @@ -51,49 +27,91 @@ export class EngineInfoManager { /** 代替ポート情報 */ public altPortInfos: AltPortInfos = {}; + private envEngineInfos = loadEnvEngineInfos(); + constructor(payload: { defaultEngineDir: string; vvppEngineDir: string }) { this.defaultEngineDir = payload.defaultEngineDir; this.vvppEngineDir = payload.vvppEngineDir; } + /** デフォルトエンジンかどうかを判定する */ + private isDefaultEngine(engineId: EngineId): boolean { + return this.envEngineInfos.some((e) => e.uuid === engineId); + } + + /** エンジンディレクトリからエンジン情報を読み込む */ + private loadEngineInfo( + engineDir: string, + type: "vvpp" | "path", + ): Result { + const manifestPath = path.join(engineDir, "engine_manifest.json"); + if (!fs.existsSync(manifestPath)) { + return failure("manifestNotFound", new Error("manifest not found")); + } + let manifest: MinimumEngineManifestType; + try { + manifest = minimumEngineManifestSchema.parse( + JSON.parse(fs.readFileSync(manifestPath, { encoding: "utf8" })), + ); + } catch (e) { + if (e instanceof Error) { + return failure("manifestParseError", e); + } else { + throw new UnreachableError(); + } + } + + const [command, ...args] = shlex.split(manifest.command); + + const engineInfo = { + uuid: manifest.uuid, + protocol: "http:", + hostname: "127.0.0.1", + defaultPort: manifest.port.toString(), + pathname: "", + name: manifest.name, + path: engineDir, + executionEnabled: true, + executionFilePath: path.join(engineDir, command), + executionArgs: args, + type, + isDefault: this.isDefaultEngine(manifest.uuid), + } satisfies EngineInfo; + return success(engineInfo); + } + /** - * 追加エンジンの一覧を取得する。 - * FIXME: store.get("registeredEngineDirs")への副作用をEngineManager外に移動する + * .envにあるエンジンの情報を取得する。 + * ダウンロードが必要なものは除外されている。 */ - private fetchAdditionalEngineInfos(): EngineInfo[] { - const engines: EngineInfo[] = []; - const addEngine = (engineDir: string, type: "vvpp" | "path") => { - const manifestPath = path.join(engineDir, "engine_manifest.json"); - if (!fs.existsSync(manifestPath)) { - return "manifestNotFound"; - } - let manifest: MinimumEngineManifestType; - try { - manifest = minimumEngineManifestSchema.parse( - JSON.parse(fs.readFileSync(manifestPath, { encoding: "utf8" })), - ); - } catch (e) { - return "manifestParseError"; - } + private fetchEnvEngineInfos(): EngineInfo[] { + // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする + const engines = loadEnvEngineInfos(); + + return engines.map((engineInfo) => { + const { protocol, hostname, port, pathname } = new URL(engineInfo.host); + return { + ...engineInfo, + protocol, + hostname, + defaultPort: port, + pathname: pathname === "/" ? "" : pathname, + isDefault: true, + type: "path", + executionFilePath: path.resolve(engineInfo.executionFilePath), + path: + engineInfo.path == undefined + ? undefined + : path.resolve(this.defaultEngineDir, engineInfo.path), + } satisfies EngineInfo; + }); + } - const [command, ...args] = shlex.split(manifest.command); - - engines.push({ - uuid: manifest.uuid, - protocol: "http:", - hostname: "127.0.0.1", - defaultPort: manifest.port.toString(), - pathname: "", - name: manifest.name, - path: engineDir, - executionEnabled: true, - executionFilePath: path.join(engineDir, command), - executionArgs: args, - type, - isDefault: false, - } satisfies EngineInfo); - return "ok"; - }; + /** + * VVPPエンジン情報の一覧を取得する。 + */ + private fetchVvppEngineInfos(): EngineInfo[] { + const engineInfos: EngineInfo[] = []; for (const dirName of fs.readdirSync(this.vvppEngineDir)) { const engineDir = path.join(this.vvppEngineDir, dirName); if (!fs.statSync(engineDir).isDirectory()) { @@ -103,17 +121,28 @@ export class EngineInfoManager { if (dirName === ".tmp") { continue; } - const result = addEngine(engineDir, "vvpp"); - if (result !== "ok") { - log.log(`Failed to load engine: ${result}, ${engineDir}`); + const result = this.loadEngineInfo(engineDir, "vvpp"); + if (!result.ok) { + log.log(`Failed to load engine: ${result.code}, ${engineDir}`); + continue; } + engineInfos.push(result.value); } + return engineInfos; + } + + /** + * 設定で登録したエンジン情報を取得する。 + * FIXME: store.get("registeredEngineDirs")への副作用をEngineManager外に移動する + */ + private fetchRegisteredEngineInfos(): EngineInfo[] { const configManager = getConfigManager(); - // FIXME: この関数の引数でregisteredEngineDirsを受け取り、動かないエンジンをreturnして、EngineManager外でconfig.setする + + const engineInfos: EngineInfo[] = []; for (const engineDir of configManager.get("registeredEngineDirs")) { - const result = addEngine(engineDir, "path"); - if (result !== "ok") { - log.log(`Failed to load engine: ${result}, ${engineDir}`); + const result = this.loadEngineInfo(engineDir, "path"); + if (!result.ok) { + log.log(`Failed to load engine: ${result.code}, ${engineDir}`); // 動かないエンジンは追加できないので削除 // FIXME: エンジン管理UIで削除可能にする dialog.showErrorBox( @@ -126,18 +155,21 @@ export class EngineInfoManager { .get("registeredEngineDirs") .filter((p) => p !== engineDir), ); + continue; } + engineInfos.push(result.value); } - return engines; + return engineInfos; } /** - * 全てのエンジンの一覧を取得する。デフォルトエンジン+追加エンジン。 + * 全てのエンジンの一覧を取得する。 */ fetchEngineInfos(): EngineInfo[] { const engineInfos = [ - ...fetchDefaultEngineInfos(this.defaultEngineDir), - ...this.fetchAdditionalEngineInfos(), + ...this.fetchEnvEngineInfos(), + ...this.fetchVvppEngineInfos(), + ...this.fetchRegisteredEngineInfos(), ]; return engineInfos; } From 13e9a14bab28b5d569aa87ec567fc406bdd60b1b Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:17:40 +0900 Subject: [PATCH 02/10] =?UTF-8?q?=E3=81=BE=E3=81=A0=E8=A6=81=E3=82=89?= =?UTF-8?q?=E3=81=AA=E3=81=8B=E3=81=A3=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 17a41a0ff3..c6f750a0d9 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -34,11 +34,6 @@ export class EngineInfoManager { this.vvppEngineDir = payload.vvppEngineDir; } - /** デフォルトエンジンかどうかを判定する */ - private isDefaultEngine(engineId: EngineId): boolean { - return this.envEngineInfos.some((e) => e.uuid === engineId); - } - /** エンジンディレクトリからエンジン情報を読み込む */ private loadEngineInfo( engineDir: string, @@ -75,7 +70,7 @@ export class EngineInfoManager { executionFilePath: path.join(engineDir, command), executionArgs: args, type, - isDefault: this.isDefaultEngine(manifest.uuid), + isDefault: false, } satisfies EngineInfo; return success(engineInfo); } From 7c8c4f8b3818f18a301480ecff469247e2ead4ba Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:20:55 +0900 Subject: [PATCH 03/10] =?UTF-8?q?=E6=88=BB=E3=81=97=E3=81=9F=E3=82=8A?= =?UTF-8?q?=E7=A7=BB=E5=8B=95=E3=81=97=E3=81=9F=E3=82=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../electron/manager/engineInfoManager.ts | 58 +++++++++---------- 1 file changed, 28 insertions(+), 30 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index c6f750a0d9..800d8eb1a9 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -19,7 +19,7 @@ import { UnreachableError } from "@/type/utility"; import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo"; import { failure, Result, success } from "@/type/result"; -/** 利用可能なエンジンの情報を管理するクラス */ +/** エンジンの情報を管理するクラス */ export class EngineInfoManager { defaultEngineDir: string; vvppEngineDir: string; @@ -27,13 +27,38 @@ export class EngineInfoManager { /** 代替ポート情報 */ public altPortInfos: AltPortInfos = {}; - private envEngineInfos = loadEnvEngineInfos(); - constructor(payload: { defaultEngineDir: string; vvppEngineDir: string }) { this.defaultEngineDir = payload.defaultEngineDir; this.vvppEngineDir = payload.vvppEngineDir; } + /** + * .envにあるエンジンの情報を取得する。 + * ダウンロードが必要なものは除外されている。 + */ + private fetchEnvEngineInfos(): EngineInfo[] { + // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする + const engines = loadEnvEngineInfos(); + + return engines.map((engineInfo) => { + const { protocol, hostname, port, pathname } = new URL(engineInfo.host); + return { + ...engineInfo, + protocol, + hostname, + defaultPort: port, + pathname: pathname === "/" ? "" : pathname, + isDefault: true, + type: "path", + executionFilePath: path.resolve(engineInfo.executionFilePath), + path: + engineInfo.path == undefined + ? undefined + : path.resolve(this.defaultEngineDir, engineInfo.path), + } satisfies EngineInfo; + }); + } + /** エンジンディレクトリからエンジン情報を読み込む */ private loadEngineInfo( engineDir: string, @@ -75,33 +100,6 @@ export class EngineInfoManager { return success(engineInfo); } - /** - * .envにあるエンジンの情報を取得する。 - * ダウンロードが必要なものは除外されている。 - */ - private fetchEnvEngineInfos(): EngineInfo[] { - // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする - const engines = loadEnvEngineInfos(); - - return engines.map((engineInfo) => { - const { protocol, hostname, port, pathname } = new URL(engineInfo.host); - return { - ...engineInfo, - protocol, - hostname, - defaultPort: port, - pathname: pathname === "/" ? "" : pathname, - isDefault: true, - type: "path", - executionFilePath: path.resolve(engineInfo.executionFilePath), - path: - engineInfo.path == undefined - ? undefined - : path.resolve(this.defaultEngineDir, engineInfo.path), - } satisfies EngineInfo; - }); - } - /** * VVPPエンジン情報の一覧を取得する。 */ From f7b17d67107ce8a8dca9b7023574650b37022a9b Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:21:32 +0900 Subject: [PATCH 04/10] =?UTF-8?q?=E7=A7=BB=E5=8B=95=E3=81=AF=E3=81=97?= =?UTF-8?q?=E3=81=AA=E3=81=84=E6=96=B9=E3=81=8C=E8=89=AF=E3=81=95=E3=81=9D?= =?UTF-8?q?=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../electron/manager/engineInfoManager.ts | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 800d8eb1a9..278789f4ab 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -32,33 +32,6 @@ export class EngineInfoManager { this.vvppEngineDir = payload.vvppEngineDir; } - /** - * .envにあるエンジンの情報を取得する。 - * ダウンロードが必要なものは除外されている。 - */ - private fetchEnvEngineInfos(): EngineInfo[] { - // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする - const engines = loadEnvEngineInfos(); - - return engines.map((engineInfo) => { - const { protocol, hostname, port, pathname } = new URL(engineInfo.host); - return { - ...engineInfo, - protocol, - hostname, - defaultPort: port, - pathname: pathname === "/" ? "" : pathname, - isDefault: true, - type: "path", - executionFilePath: path.resolve(engineInfo.executionFilePath), - path: - engineInfo.path == undefined - ? undefined - : path.resolve(this.defaultEngineDir, engineInfo.path), - } satisfies EngineInfo; - }); - } - /** エンジンディレクトリからエンジン情報を読み込む */ private loadEngineInfo( engineDir: string, @@ -100,6 +73,33 @@ export class EngineInfoManager { return success(engineInfo); } + /** + * .envにあるエンジンの情報を取得する。 + * ダウンロードが必要なものは除外されている。 + */ + private fetchEnvEngineInfos(): EngineInfo[] { + // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする + const engines = loadEnvEngineInfos(); + + return engines.map((engineInfo) => { + const { protocol, hostname, port, pathname } = new URL(engineInfo.host); + return { + ...engineInfo, + protocol, + hostname, + defaultPort: port, + pathname: pathname === "/" ? "" : pathname, + isDefault: true, + type: "path", + executionFilePath: path.resolve(engineInfo.executionFilePath), + path: + engineInfo.path == undefined + ? undefined + : path.resolve(this.defaultEngineDir, engineInfo.path), + } satisfies EngineInfo; + }); + } + /** * VVPPエンジン情報の一覧を取得する。 */ From 32a2f2ecee2bfcc3757446a4b67f2a3c7d0362a4 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:24:37 +0900 Subject: [PATCH 05/10] =?UTF-8?q?FIXME=E8=A6=81=E3=82=89=E3=81=AA=E3=81=8F?= =?UTF-8?q?=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 278789f4ab..82147b314c 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -126,7 +126,6 @@ export class EngineInfoManager { /** * 設定で登録したエンジン情報を取得する。 - * FIXME: store.get("registeredEngineDirs")への副作用をEngineManager外に移動する */ private fetchRegisteredEngineInfos(): EngineInfo[] { const configManager = getConfigManager(); From bacf68868382c06bb2c7ace1bf6749ea843e5bea Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:32:00 +0900 Subject: [PATCH 06/10] =?UTF-8?q?=E3=81=A1=E3=82=87=E3=81=A3=E3=81=A8?= =?UTF-8?q?=E3=82=8F=E3=81=8B=E3=82=8A=E3=82=84=E3=81=99=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 82147b314c..93b5b929a6 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -15,7 +15,6 @@ import { minimumEngineManifestSchema, } from "@/type/preload"; import { AltPortInfos } from "@/store/type"; -import { UnreachableError } from "@/type/utility"; import { loadEnvEngineInfos } from "@/domain/defaultEngine/envEngineInfo"; import { failure, Result, success } from "@/type/result"; @@ -47,11 +46,10 @@ export class EngineInfoManager { JSON.parse(fs.readFileSync(manifestPath, { encoding: "utf8" })), ); } catch (e) { - if (e instanceof Error) { - return failure("manifestParseError", e); - } else { - throw new UnreachableError(); - } + return failure( + "manifestParseError", + e instanceof Error ? e : new Error("manifest parse error"), + ); } const [command, ...args] = shlex.split(manifest.command); From c0219f2e37bcc4dc4e39e56b45ef29ac93f1e499 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:33:43 +0900 Subject: [PATCH 07/10] =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E3=81=AE=E5=8F=96=E5=BE=97=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 93b5b929a6..3a4727cd41 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -99,7 +99,7 @@ export class EngineInfoManager { } /** - * VVPPエンジン情報の一覧を取得する。 + * VVPPエンジンの情報を取得する。 */ private fetchVvppEngineInfos(): EngineInfo[] { const engineInfos: EngineInfo[] = []; @@ -123,7 +123,7 @@ export class EngineInfoManager { } /** - * 設定で登録したエンジン情報を取得する。 + * 設定で登録したエンジンの情報を取得する。 */ private fetchRegisteredEngineInfos(): EngineInfo[] { const configManager = getConfigManager(); From d8013ae750aff910d84f5cc2e7845c2362ec3200 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Thu, 7 Nov 2024 04:36:25 +0900 Subject: [PATCH 08/10] =?UTF-8?q?=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3?= =?UTF-8?q?=E6=83=85=E5=A0=B1=E3=81=AE=E5=8F=96=E5=BE=97=E3=81=AB=E9=96=A2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 3a4727cd41..df0b91d21c 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -153,7 +153,7 @@ export class EngineInfoManager { } /** - * 全てのエンジンの一覧を取得する。 + * 全てのエンジンの情報を取得する。 */ fetchEngineInfos(): EngineInfo[] { const engineInfos = [ From ce1f213eaca3c20dd134f73ee54ea9e90ae334d2 Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Mon, 11 Nov 2024 02:39:22 +0900 Subject: [PATCH 09/10] =?UTF-8?q?=E3=82=B3=E3=83=A1=E3=83=B3=E3=83=88?= =?UTF-8?q?=E3=81=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index df0b91d21c..4fc48f79ab 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -31,7 +31,7 @@ export class EngineInfoManager { this.vvppEngineDir = payload.vvppEngineDir; } - /** エンジンディレクトリからエンジン情報を読み込む */ + /** エンジンディレクトリのエンジンマニフェストからエンジンの情報を読み込む */ private loadEngineInfo( engineDir: string, type: "vvpp" | "path", @@ -54,7 +54,7 @@ export class EngineInfoManager { const [command, ...args] = shlex.split(manifest.command); - const engineInfo = { + return success({ uuid: manifest.uuid, protocol: "http:", hostname: "127.0.0.1", @@ -67,13 +67,11 @@ export class EngineInfoManager { executionArgs: args, type, isDefault: false, - } satisfies EngineInfo; - return success(engineInfo); + } satisfies EngineInfo); } /** * .envにあるエンジンの情報を取得する。 - * ダウンロードが必要なものは除外されている。 */ private fetchEnvEngineInfos(): EngineInfo[] { // TODO: envから直接ではなく、envに書いたengine_manifest.jsonから情報を得るようにする From c9286c31ec7902feb46dbe410639985b9a2108bb Mon Sep 17 00:00:00 2001 From: Hiroshiba Date: Mon, 11 Nov 2024 02:40:00 +0900 Subject: [PATCH 10/10] =?UTF-8?q?docs:=20=E3=82=A8=E3=83=B3=E3=82=B8?= =?UTF-8?q?=E3=83=B3=E6=83=85=E5=A0=B1=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=81=AE=E3=82=B3=E3=83=A1?= =?UTF-8?q?=E3=83=B3=E3=83=88=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/electron/manager/engineInfoManager.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend/electron/manager/engineInfoManager.ts b/src/backend/electron/manager/engineInfoManager.ts index 4fc48f79ab..f9471194f0 100644 --- a/src/backend/electron/manager/engineInfoManager.ts +++ b/src/backend/electron/manager/engineInfoManager.ts @@ -31,7 +31,9 @@ export class EngineInfoManager { this.vvppEngineDir = payload.vvppEngineDir; } - /** エンジンディレクトリのエンジンマニフェストからエンジンの情報を読み込む */ + /** + * エンジンディレクトリのエンジンマニフェストからエンジンの情報を読み込む。 + */ private loadEngineInfo( engineDir: string, type: "vvpp" | "path",