From 43def441364d2f5d482aac17d92339db3d400811 Mon Sep 17 00:00:00 2001 From: Cooldude2606 <25043174+Cooldude2606@users.noreply.github.com> Date: Fri, 7 Nov 2025 21:47:48 +0000 Subject: [PATCH] Fix package path for restart required --- packages/controller/src/Controller.ts | 6 ++++-- packages/host/src/Host.ts | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/controller/src/Controller.ts b/packages/controller/src/Controller.ts index 0fa27628..a22181b1 100644 --- a/packages/controller/src/Controller.ts +++ b/packages/controller/src/Controller.ts @@ -570,7 +570,8 @@ export default class Controller { try { // First check the clusterio version const runningVersion = this.config.get("controller.version"); - const packageJson = await fs.readJSON(path.join(__dirname, "..", "package.json")); + const packageJsonPath = require.resolve("@clusterio/controller/package.json"); + const packageJson = await fs.readJSON(packageJsonPath); if (runningVersion !== packageJson.version) { this.config.restartRequired = true; return true; @@ -586,7 +587,8 @@ export default class Controller { } packageName = pluginInfo.npmPackage ?? pluginInfo.name; - const pluginPackageJson = await fs.readJSON(path.join(pluginInfo.requirePath, "package.json")); + const pluginPackageJsonPath = require.resolve(path.posix.join(pluginInfo.requirePath, "package.json")); + const pluginPackageJson = await fs.readJSON(pluginPackageJsonPath); if (pluginInfo.version !== pluginPackageJson.version) { this.config.restartRequired = true; return true; diff --git a/packages/host/src/Host.ts b/packages/host/src/Host.ts index c7409990..55cf5763 100644 --- a/packages/host/src/Host.ts +++ b/packages/host/src/Host.ts @@ -819,7 +819,8 @@ export default class Host extends lib.Link { try { // First check the clusterio version const runningVersion = this.config.get("host.version"); - const packageJson = await fs.readJSON(path.join(__dirname, "..", "package.json")); + const packageJsonPath = require.resolve("@clusterio/host/package.json"); + const packageJson = await fs.readJSON(packageJsonPath); if (runningVersion !== packageJson.version) { this.config.restartRequired = true; return true; @@ -835,7 +836,8 @@ export default class Host extends lib.Link { } packageName = pluginInfo.npmPackage ?? pluginInfo.name; - const pluginPackageJson = await fs.readJSON(path.join(pluginInfo.requirePath, "package.json")); + const pluginPackageJsonPath = require.resolve(path.posix.join(pluginInfo.requirePath, "package.json")); + const pluginPackageJson = await fs.readJSON(pluginPackageJsonPath); if (pluginInfo.version !== pluginPackageJson.version) { this.config.restartRequired = true; return true;