Skip to content

Commit

Permalink
fixed usage of config.has
Browse files Browse the repository at this point in the history
  • Loading branch information
bafto committed Dec 5, 2023
1 parent e1bf557 commit 95f2e16
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ export function activate(ctx: vscode.ExtensionContext) {
let config = vscode.workspace.getConfiguration('ddp');

let commandName = "DDPLS";
if (config.has("DDPLS.path")) {
let ddplsPath = config.get<string>("DDPLS.path");
if (ddplsPath !== "" && ddplsPath !== undefined) {
commandName = ddplsPath;
}
} else {
{
let ddplsPath = ctx.asAbsolutePath(path.join('bin', os.platform() === 'win32' ? 'DDPLS.exe' : 'DDPLS'));
out.appendLine("bundled ddplsPath: " + ddplsPath);
if (fs.existsSync(ddplsPath)) {
out.appendLine("using bundled DDPLS");
out.appendLine(ddplsPath);
commandName = ddplsPath;
}
}
{
let ddplsPath = config.get<string>("DDPLS.path");
if (ddplsPath !== "" && ddplsPath !== undefined) {
out.appendLine("using custom DDPLS path");
commandName = ddplsPath;
}
}
Expand Down

0 comments on commit 95f2e16

Please sign in to comment.