From 6de61756977908a0871ffd769b718c7e7a822145 Mon Sep 17 00:00:00 2001 From: Tnks2U Date: Mon, 30 Oct 2023 21:36:22 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20getEntryjsPath=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 인공지능 손인식 블럭 대응 --- src/preload/preload.ts | 12 +++++++++--- types/window.d.ts | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/preload/preload.ts b/src/preload/preload.ts index d0e70d126..1ad007124 100644 --- a/src/preload/preload.ts +++ b/src/preload/preload.ts @@ -22,7 +22,7 @@ ipcRenderer.on( const { x, y, width, height } = dimension || {}; const imageElement = width && height ? new Image(width, height) : new Image(); - imageElement.onload = function () { + imageElement.onload = function() { canvas.width = imageElement.width; canvas.height = imageElement.height; @@ -66,7 +66,7 @@ window.ipcInvoke = (channel: string, ...args: any[]) => { window.ipcSend = (channel: string, ...args: any[]) => { ipcRenderer.send(channel, ...args); -} +}; window.openEntryWebPage = () => { shell.openExternal('https://playentry.org/download/offline'); @@ -83,10 +83,16 @@ window.weightsPath = () => { : path.resolve(remote.app.getAppPath(), 'node_modules', 'entry-js', 'weights'); }; +window.getEntryjsPath = () => { + return process.env.NODE_ENV === 'production' + ? path.resolve(process.resourcesPath, 'app.asar.unpacked', 'node_modules', 'entry-js') + : path.resolve(remote.app.getAppPath(), 'node_modules', 'entry-js'); +}; + window.getAppPathWithParams = (...params: string[]) => { console.log(process.env.NODE_ENV); return path.resolve(remote.app.getAppPath(), ...params); -} +}; /** * external file => loadProjectFromMain event => loadProject => callback(project) diff --git a/types/window.d.ts b/types/window.d.ts index ae7910976..ce8d012cb 100644 --- a/types/window.d.ts +++ b/types/window.d.ts @@ -26,6 +26,7 @@ declare interface Preload { openHardwarePage(): void; checkPermission(type: 'microphone' | 'camera'): Promise; weightsPath: () => string; + getEntryjsPath: () => string; getAppPathWithParams: (...params: string[]) => string; }