Skip to content

Commit d980aab

Browse files
authored
Merge pull request #656 from daviwil/fix-655
Fix issue with cwd being set to untitled file path
2 parents cf95f1b + 38c85be commit d980aab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/features/DebugSession.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class DebugSessionFeature implements IFeature {
4242

4343
if (config.request === 'launch') {
4444
// Make sure there's a usable working directory if possible
45-
config.cwd = config.cwd || vscode.workspace.rootPath || config.script;
45+
config.cwd = config.cwd || vscode.workspace.rootPath;
4646

4747
// For launch of "current script", don't start the debugger if the current file
4848
// is not a file that can be debugged by PowerShell
@@ -80,6 +80,12 @@ export class DebugSessionFeature implements IFeature {
8080
}
8181
}
8282
}
83+
else if (config.script) {
84+
// In this case, the user has explicitly defined a script path
85+
// so make sure to set the cwd to that path if the cwd wasn't
86+
// explicitly set
87+
config.cwd = config.cwd || config.script;
88+
}
8389
}
8490

8591
// Prevent the Debug Console from opening

0 commit comments

Comments
 (0)