From a4a11984021394bbe2194fcd7751abc16927c14b Mon Sep 17 00:00:00 2001 From: mozzie Date: Tue, 10 Sep 2024 17:10:31 +0800 Subject: [PATCH] refactor: update dev orthanc directory --- apps/desktop/electron/main.ts | 47 ++++++++++-------- .../extraResources/orthanc-mac-24.8.1/Orthanc | Bin 2 files changed, 25 insertions(+), 22 deletions(-) mode change 100644 => 100755 apps/desktop/extraResources/orthanc-mac-24.8.1/Orthanc diff --git a/apps/desktop/electron/main.ts b/apps/desktop/electron/main.ts index 36108ae..feac7bf 100644 --- a/apps/desktop/electron/main.ts +++ b/apps/desktop/electron/main.ts @@ -14,10 +14,9 @@ import { getMachineId } from "./core/auth"; import registerIpcMainHandlers from "./ipcMainHandlers"; import { spawn } from "node:child_process"; import { ChildProcessWithoutNullStreams } from "child_process"; -import log from 'electron-log'; +import log from "electron-log"; import { existsSync } from "node:fs"; - // const require = createRequire(import.meta.url); const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -68,8 +67,6 @@ function createWindow() { }); }); - - if (VITE_DEV_SERVER_URL) { win.loadURL(VITE_DEV_SERVER_URL); registerIpcMainHandlers(win); @@ -77,16 +74,20 @@ function createWindow() { const pacsPath = platform !== "macos" ? path.join( - process.env.VITE_PUBLIC!, - "../extraResources", - "orthanc-win64-1.12.4", - "Orthanc.exe" - ) - : path.join(process.env.VITE_PUBLIC!, '../extraResources', "orthanc-mac-24.8.1", "Orthanc"); + process.env.APP_ROOT!, + "extraResources", + "orthanc-win64-1.12.4", + "Orthanc.exe" + ) + : path.join( + process.env.APP_ROOT!, + "extraResources", + "orthanc-mac-24.8.1", + "Orthanc" + ); spawn(pacsPath); - if (platform !== "macos") { python_process = spawn(path.join(process.env.VITE_PUBLIC!, "main.exe")); } @@ -95,22 +96,24 @@ function createWindow() { // python_process = spawn(path.join(process.env.VITE_PUBLIC!, "main.exe")); // } - - - const pacsPath = platform !== "macos" ? path.join( - process.resourcesPath, 'lib', - "orthanc-win64-1.12.4", - "Orthanc.exe" - ) - : path.join(process.resourcesPath, 'lib', "orthanc-mac-24.8.1", "Orthanc"); + process.resourcesPath, + "lib", + "orthanc-win64-1.12.4", + "Orthanc.exe" + ) + : path.join( + process.resourcesPath, + "lib", + "orthanc-mac-24.8.1", + "Orthanc" + ); - console.log(pacsPath) + console.log(pacsPath); log.info(pacsPath); - if (existsSync(pacsPath)) - spawn(pacsPath); + if (existsSync(pacsPath)) spawn(pacsPath); win.loadFile(path.join(RENDERER_DIST, "index.html")).then(() => { if (process.argv.length >= 2) { diff --git a/apps/desktop/extraResources/orthanc-mac-24.8.1/Orthanc b/apps/desktop/extraResources/orthanc-mac-24.8.1/Orthanc old mode 100644 new mode 100755