Skip to content

Commit

Permalink
fix: Work with global config.
Browse files Browse the repository at this point in the history
  • Loading branch information
xhiroga authored Feb 8, 2020
1 parent 94d6d8e commit 2c22844
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
return undefined;
}

if (!folder) {
let msg = "Unable to determine workspace folder.";
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
}

// Else launch.json exists
if (!config.type || !config.name) {
let msg = "BUG in Bash Debug: reached to unreachable code.";
Expand Down Expand Up @@ -88,7 +83,13 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
// Fill non-"required" attributes with default values to prevent bashdb (or other programs) from panic
if (!config.args) { config.args = []; }
if (!config.env) { config.env = {}; }
if (!config.cwd) { config.cwd = folder.uri.fsPath; }
if (!config.cwd) {
if (!folder) {
let msg = "Unable to determine workspace folder.";
return vscode.window.showErrorMessage(msg).then(_ => { return undefined; });
}
config.cwd = folder.uri.fsPath;
}
if (!config.pathBash) {
config.pathBash = "bash";
}
Expand All @@ -113,7 +114,7 @@ class BashConfigurationProvider implements vscode.DebugConfigurationProvider {
if (!config.pathMkfifo) { config.pathMkfifo = "mkfifo"; }
if (!config.pathPkill) {

if ( process.platform === "darwin" ) {
if (process.platform === "darwin") {
const pathPkill = which(__dirname).sync('pkill');
if (pathPkill === "/usr/local/bin/pkill") {
vscode.window.showInformationMessage(`Using /usr/bin/pkill instead of /usr/local/bin/pkill`);
Expand Down

0 comments on commit 2c22844

Please sign in to comment.