Skip to content

Commit e7076f9

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Add function that appends a suffix to a given file path
This function will increment file numbers when running autofix in a loop
1 parent 74e8277 commit e7076f9

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

extensions/ql-vscode/src/variant-analysis/view-autofixes.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,3 +662,14 @@ function execAutofix(
662662
}
663663
});
664664
}
665+
666+
/**
667+
* Creates a new file path by appending the given suffix.
668+
* @param filePath The original file path.
669+
* @param suffix The suffix to append to the file name (before the extension).
670+
* @returns The new file path with the suffix appended.
671+
*/
672+
function appendSuffixToFilePath(filePath: string, suffix: string): string {
673+
const { dir, name, ext } = parse(filePath);
674+
return join(dir, `${name}-${suffix}${ext}`);
675+
}

0 commit comments

Comments
 (0)