diff --git a/electron/.eslintrc.js b/electron/.eslintrc.js index 950f2b4ea..873b619b8 100644 --- a/electron/.eslintrc.js +++ b/electron/.eslintrc.js @@ -12,8 +12,11 @@ module.exports = { ], rules: { "@typescript-eslint/no-non-null-assertion": "off", - quotes: ["error", "single"], "react/prop-types": "off", // In favor of strong typing - no need to dedupe + "@typescript-eslint/no-var-requires": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off", }, settings: { react: { diff --git a/electron/core/plugins/inference-plugin/module.js b/electron/core/plugins/inference-plugin/module.js index 2918f68c7..ea8e097a8 100644 --- a/electron/core/plugins/inference-plugin/module.js +++ b/electron/core/plugins/inference-plugin/module.js @@ -2,6 +2,7 @@ const path = require("path"); const { app, dialog } = require("electron"); const { spawn } = require("child_process"); const fs = require("fs"); +var exec = require("child_process").exec; let subprocess = null; @@ -34,10 +35,10 @@ async function initModel(product) { killSubprocess(); } - let binaryFolder = `${__dirname}/nitro`; // Current directory by default + let binaryFolder = path.join(__dirname, "nitro"); // Current directory by default // Read the existing config - const configFilePath = `${binaryFolder}/config/config.json`; + const configFilePath = path.join(binaryFolder, "config", "config.json"); let config = {}; if (fs.existsSync(configFilePath)) { const rawData = fs.readFileSync(configFilePath, "utf-8"); @@ -56,8 +57,13 @@ async function initModel(product) { // Write the updated config back to the file fs.writeFileSync(configFilePath, JSON.stringify(config, null, 4)); + const binaryPath = + process.platform === "win32" + ? path.join(binaryFolder, "nitro.exe") + : path.join(binaryFolder, "nitro"); // Execute the binary - subprocess = spawn(`${binaryFolder}/nitro`, [configFilePath]); + + subprocess = spawn(binaryPath, [configFilePath], {cwd: binaryFolder}); // Handle subprocess output subprocess.stdout.on("data", (data) => { diff --git a/electron/core/plugins/inference-plugin/nitro/nitro.exe b/electron/core/plugins/inference-plugin/nitro/nitro.exe new file mode 100644 index 000000000..d0fbcb117 Binary files /dev/null and b/electron/core/plugins/inference-plugin/nitro/nitro.exe differ diff --git a/electron/core/plugins/inference-plugin/nitro/zlib.dll b/electron/core/plugins/inference-plugin/nitro/zlib.dll new file mode 100644 index 000000000..72db396cf Binary files /dev/null and b/electron/core/plugins/inference-plugin/nitro/zlib.dll differ