File tree Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Expand file tree Collapse file tree 3 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 77* Fix various task variables not getting resolved with ` cppbuild ` tasks. [ #6538 ] ( https://github.com/microsoft/vscode-cpptools/issues/6538 )
88* Fix warnings not appearing with ` cppbuild ` tasks. [ #6556 ] ( https://github.com/microsoft/vscode-cpptools/issues/6556 )
99* Fix endless CPU/memory usage if the cpptools process crashes. [ #6603 ] ( https://github.com/microsoft/vscode-cpptools/issues/6603 )
10+ * Fix the default ` cwd ` for ` cppbuild ` tasks. [ #6618 ] ( https://github.com/microsoft/vscode-cpptools/issues/6618 )
1011
1112## Version 1.1.2: November 17, 2020
1213### Bug Fix
Original file line number Diff line number Diff line change @@ -178,10 +178,13 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
178178 newConfig . preLaunchTask = task . name ;
179179 newConfig . externalConsole = false ;
180180 const exeName : string = path . join ( "${fileDirname}" , "${fileBasenameNoExtension}" ) ;
181- newConfig . program = platform === "win32" ? exeName + ".exe" : exeName ;
181+ const isWindows : boolean = platform === 'win32' ;
182+ newConfig . program = isWindows ? exeName + ".exe" : exeName ;
182183 // Add the "detail" property to show the compiler path in QuickPickItem.
183184 // This property will be removed before writing the DebugConfiguration in launch.json.
184185 newConfig . detail = task . detail ? task . detail : definition . command ;
186+ const isCl : boolean = compilerName === "cl.exe" ;
187+ newConfig . cwd = isWindows && ! isCl && ! process . env . PATH ?. includes ( compilerPath ) ? path . dirname ( compilerPath ) : "${workspaceFolder}" ;
185188
186189 return new Promise < vscode . DebugConfiguration > ( resolve => {
187190 if ( platform === "darwin" ) {
@@ -201,7 +204,7 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider {
201204 debuggerName = "gdb" ;
202205 }
203206
204- if ( platform === "win32" ) {
207+ if ( isWindows ) {
205208 debuggerName += ".exe" ;
206209 }
207210
Original file line number Diff line number Diff line change @@ -167,7 +167,7 @@ export class CppBuildTaskProvider implements TaskProvider {
167167 if ( compilerArgs && compilerArgs . length > 0 ) {
168168 args = args . concat ( compilerArgs ) ;
169169 }
170- const cwd : string = isCl ? "${workspaceFolder}" : path . dirname ( compilerPath ) ;
170+ const cwd : string = isWindows && ! isCl && ! process . env . PATH ?. includes ( compilerPath ) ? path . dirname ( compilerPath ) : "${workspaceFolder}" ;
171171 const options : cp . ExecOptions | undefined = { cwd : cwd } ;
172172 definition = {
173173 type : CppBuildTaskProvider . CppBuildScriptType ,
You can’t perform that action at this time.
0 commit comments