Skip to content

Commit

Permalink
Ignore Comments in .rsp files
Browse files Browse the repository at this point in the history
Example of an .rsp file:
"/example/to/binary/example.exe" # Binary
# ---- Libraries ----
"/example/to/libraries/library1.dll"
"/example/to/libraries/library2.dll"

would result in:
"/example/to/binary/example.exe"
"/example/to/libraries/library1.dll"
"/example/to/libraries/library2.dll"
  • Loading branch information
Lukas Kohl committed Oct 17, 2024
1 parent 8d31b06 commit a22509c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/BinSkim.Driver/ExpandArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ private static void ExpandResponseFile(string[] responseFileLines, List<string>
{
foreach (string responseFileLine in responseFileLines)
{
List<string> fileList = ArgumentSplitter.CommandLineToArgvW(responseFileLine.Trim()) ??
string responseFilePath = responseFileLine;

// Ignore comments from response file lines
int commentIndex = responseFileLine.IndexOf('#');
if (commentIndex >= 0) {
responseFilePath = responseFileLine.Substring(0, commentIndex);
}

List<string> fileList = ArgumentSplitter.CommandLineToArgvW(responseFilePath.Trim()) ??
throw new InvalidOperationException("Could not parse response file line:" + responseFileLine);

expandedArguments.AddRange(fileList);
Expand Down

0 comments on commit a22509c

Please sign in to comment.