Skip to content

Commit 54e4135

Browse files
committed
fix/ #59 resolve paths for all paths in arguments
1 parent 9945b66 commit 54e4135

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/extension.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as xml2js from 'xml2js';
55

66
import { documentationLinkMap } from './util/documentation';
77
import { runCommand } from './util/scripts';
8-
import { resolvePath, findWorkspaceRoot } from './util/path';
8+
import { isPath, resolvePath, findWorkspaceRoot } from './util/path';
99

1010
enum SeverityNumber {
1111
Info = 0,
@@ -187,8 +187,8 @@ async function runCppcheckOnFileXML(
187187

188188
// Resolve paths for arguments where applicable
189189
const argsParsed = processedArgs.split(" ").map((arg) => {
190-
if (arg.startsWith('--project')) {
191-
const splitArg = arg.split('=');
190+
const splitArg = arg.split('=');
191+
if (isPath(splitArg[1])) {
192192
return `${splitArg[0]}=${resolvePath(splitArg[1])}`;
193193
}
194194
return arg;

src/util/path.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@ import * as path from "path";
22
import * as os from "os";
33
import * as vscode from 'vscode';
44

5+
export function isPath(arg: string): boolean {
6+
if (arg.includes('/') || arg.includes('\\')) {
7+
return true;
8+
}
9+
return false;
10+
}
11+
512
export function findWorkspaceRoot(): string {
613
const folders = vscode.workspace.workspaceFolders;
714
const workspaceRoot = folders && folders.length > 0

0 commit comments

Comments
 (0)