File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import * as path from "path";
44import * as xml2js from 'xml2js' ;
55
66import { runCommand } from './util/scripts' ;
7- import { resolvePath } from './util/path' ;
7+ import { resolvePath , findWorkspaceRoot } from './util/path' ;
88
99enum SeverityNumber {
1010 Info = 0 ,
@@ -219,8 +219,10 @@ async function runCppcheckOnFileXML(
219219 ...argsParsed ,
220220 filePath ,
221221 ] . filter ( Boolean ) ;
222+
223+ const cwd = findWorkspaceRoot ( ) ;
222224 proc = cp . spawn ( commandPath , args , {
223- cwd : path . dirname ( document . fileName ) ,
225+ cwd,
224226 } ) ;
225227 }
226228
Original file line number Diff line number Diff line change @@ -2,11 +2,16 @@ import * as path from "path";
22import * as os from "os" ;
33import * as vscode from 'vscode' ;
44
5- export function resolvePath ( argPath : string ) : string {
5+ export function findWorkspaceRoot ( ) : string {
66 const folders = vscode . workspace . workspaceFolders ;
77 const workspaceRoot = folders && folders . length > 0
88 ? folders [ 0 ] . uri . fsPath
99 : process . cwd ( ) ;
10+ return workspaceRoot ;
11+ }
12+
13+ export function resolvePath ( argPath : string ) : string {
14+ const workspaceRoot = findWorkspaceRoot ( ) ;
1015
1116 // Expand ${workspaceFolder}
1217 if ( argPath . includes ( "${workspaceFolder}" ) ) {
You can’t perform that action at this time.
0 commit comments