diff --git a/electron/bridge.ts b/electron/bridge.ts index 1a0e265..df69f63 100644 --- a/electron/bridge.ts +++ b/electron/bridge.ts @@ -1,6 +1,7 @@ import { PaletteMode } from '@mui/material'; import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron'; import { promises as fs } from 'fs'; +import { sep as pathSep } from 'path'; import ModuleSet from '../src/@types/ModuleSet'; import Settings from './Settings'; @@ -15,7 +16,7 @@ type StringFunction = (data: string) => void; const callbacks: { [name: number]: (IntegerFunction | StringFunction)[] } = {}; function getFileFromRoot(file: string): string { - return `${Settings.Instance.JsonPath}\\${file}`; + return `${Settings.Instance.JsonPath}${pathSep}${file}`; } // max listeners per address is log2(65536) = 16 @@ -67,7 +68,6 @@ export const api = { try { const buffer = await fs.readFile(getFileFromRoot('AircraftAliases.json')); const data: AircraftData = JSON.parse(buffer.toString()); - // we can parse the values of AircraftAliases.json to find the json files for all modules Object.entries(data).forEach(entry => { const values = entry[1]; @@ -76,6 +76,7 @@ export const api = { } }); } catch (e) { + console.log(e); modulesSet.clear(); } diff --git a/package-lock.json b/package-lock.json index 60512fe..8528448 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,6 +39,7 @@ "@testing-library/react": "^13.0.1", "@types/electron-devtools-installer": "^2.2.1", "@types/jest": "^27.4.1", + "@types/node": "^22.10.0", "@types/react": "^18.0.4", "@types/react-dom": "^18.0.0", "@types/styled-components": "^5.1.25", @@ -5214,9 +5215,13 @@ "optional": true }, "node_modules/@types/node": { - "version": "16.18.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.10.tgz", - "integrity": "sha512-XU1+v7h81p7145ddPfjv7jtWvkSilpcnON3mQ+bDi9Yuf7OI56efOglXRyXWgQ57xH3fEQgh7WOJMncRHVew5w==" + "version": "22.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.0.tgz", + "integrity": "sha512-XC70cRZVElFHfIUB40FgZOBbgJYFKKMa5nb9lxcwYstFG/Mi+/Y0bGS+rs6Dmhmkpq4pnNiLiuZAbc02YCOnmA==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } }, "node_modules/@types/parse-json": { "version": "4.0.0", @@ -8977,6 +8982,13 @@ "node": ">=6" } }, + "node_modules/electron/node_modules/@types/node": { + "version": "16.18.120", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.120.tgz", + "integrity": "sha512-Dmi4bhZ7CHyD4sv4awCZx9RBxWOXSejxTF6B5WQ5UzfLcyEg7JqdDDsjvdMRYES9EcTWHlHZe01PInSj18yP2A==", + "dev": true, + "license": "MIT" + }, "node_modules/electron/node_modules/cacheable-request": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", @@ -18927,6 +18939,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "license": "MIT" + }, "node_modules/unicode-canonical-property-names-ecmascript": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", diff --git a/package.json b/package.json index 5e53406..14cd02c 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,7 @@ "@testing-library/react": "^13.0.1", "@types/electron-devtools-installer": "^2.2.1", "@types/jest": "^27.4.1", + "@types/node": "^22.10.0", "@types/react": "^18.0.4", "@types/react-dom": "^18.0.0", "@types/styled-components": "^5.1.25",