From bfa05297b277b8c00fd3cbcd1f7c9084dbb1bd0c Mon Sep 17 00:00:00 2001 From: DJj123dj <80536295+DJj123dj@users.noreply.github.com> Date: Sun, 1 Sep 2024 17:30:25 +0200 Subject: [PATCH] Fixed plugins not loading on windows --- src/core/api/modules/plugin.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/api/modules/plugin.ts b/src/core/api/modules/plugin.ts index e73299d..ac01ef4 100644 --- a/src/core/api/modules/plugin.ts +++ b/src/core/api/modules/plugin.ts @@ -91,7 +91,12 @@ export class ODPlugin extends ODManagerData { async execute(debug:ODDebugger,force?:boolean): Promise { if ((this.enabled && !this.crashed) || force){ try{ - await import(nodepath.join("../../../../plugins/",this.getStartFile())) + //rewrite the path to make it work on windows & unix based systems + const workingDir = process.cwd().replace(/C:\\/i,"/") + const workingPath = nodepath.join("./dist/plugins/",this.getStartFile()) + const pluginPath = nodepath.join(workingDir,workingPath).split(nodepath.sep).join("/") + + await import(pluginPath) debug.console.log("Plugin \""+this.id.value+"\" loaded successfully!","plugin") this.executed = true return true