Skip to content

Commit

Permalink
Use path.sep as path separator
Browse files Browse the repository at this point in the history
  • Loading branch information
joleaf committed Jan 12, 2023
1 parent ce145c0 commit e32ca8a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {Plugin, parseYaml} from "obsidian";
import {exec} from 'child_process';
import {dmnEvaluatorBase64} from './DmnEvaluator';
import {unlinkSync, appendFileSync, existsSync} from "fs";
import * as path from "path";

interface DmnNodeParameters {
url: string;
Expand Down Expand Up @@ -74,7 +75,7 @@ export default class ObsidianDmnEvalPlugin extends Plugin {
}

private async createDMNEvaluatorJar() {
let dmnJarPath = this.getPluginPath() + "/DmnEvaluator.jar";
let dmnJarPath = this.getPluginPath() + path.sep + "DmnEvaluator.jar";
if (existsSync(dmnJarPath)) {
unlinkSync(dmnJarPath);
}
Expand All @@ -83,7 +84,7 @@ export default class ObsidianDmnEvalPlugin extends Plugin {

private getPluginPath() {
//@ts-ignore
return this.app.vault.adapter.basePath + "/" + app.vault.configDir + "/plugins/dmn-eval-plugin";
return this.app.vault.adapter.basePath + path.sep + app.vault.configDir + path.sep + "plugins" + path.sep + "dmn-eval-plugin";
}

private renderResult(lines: string[], rootElement: HTMLElement, parameters: DmnNodeParameters) {
Expand Down Expand Up @@ -170,7 +171,7 @@ export default class ObsidianDmnEvalPlugin extends Plugin {

onunload() {
console.log("Unloading DMN Eval plugin...");
let dmnJarPath = this.getPluginPath() + "/DmnEvaluator.jar";
let dmnJarPath = this.getPluginPath() + path.sep + "DmnEvaluator.jar";
if (existsSync(dmnJarPath)) {
unlinkSync(dmnJarPath);
}
Expand Down

0 comments on commit e32ca8a

Please sign in to comment.