fix: #122 improved windows OT plugin support
Open Ticket instances with plugins are now also able to exist outside of the default C:\\ drive on windows. This has been fixed by searching for the plugins relative to the bot instead of using an absolute path.
This commit is contained in:
@@ -146,11 +146,8 @@ export class ODPlugin extends ODManagerData {
|
|||||||
async execute(debug:ODDebugger,force?:boolean): Promise<boolean> {
|
async execute(debug:ODDebugger,force?:boolean): Promise<boolean> {
|
||||||
if ((this.enabled && !this.crashed) || force){
|
if ((this.enabled && !this.crashed) || force){
|
||||||
try{
|
try{
|
||||||
//rewrite the path to make it work on windows & unix based systems
|
//import relative plugin directory path (works on windows & unix based systems)
|
||||||
const workingDir = process.cwd().replace(/C:\\/i,"/")
|
const pluginPath = nodepath.join("../../../../plugins/",this.getStartFile())
|
||||||
const workingPath = nodepath.join("./dist/plugins/",this.getStartFile())
|
|
||||||
const pluginPath = nodepath.join(workingDir,workingPath).split(nodepath.sep).join("/")
|
|
||||||
|
|
||||||
await import(pluginPath)
|
await import(pluginPath)
|
||||||
debug.console.log("Plugin \""+this.id.value+"\" loaded successfully!","plugin")
|
debug.console.log("Plugin \""+this.id.value+"\" loaded successfully!","plugin")
|
||||||
this.executed = true
|
this.executed = true
|
||||||
|
|||||||
Reference in New Issue
Block a user