Skip to content

Commit

Permalink
ScrapeHeaders: Trim filenames when splitting for ;
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Sep 3, 2024
1 parent 5c94c97 commit c311d46
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions sources/GeneratorSdk/MetadataTasks/ScrapeHeaders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public override bool Execute()

if (!string.IsNullOrEmpty(this.ExcludeFromCrossarch))
{
foreach (var part in this.ExcludeFromCrossarch.Split(';', System.StringSplitOptions.RemoveEmptyEntries))
foreach (var part in this.ExcludeFromCrossarch.Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries))
{
this.partitionsToExcludeFromCrossarch.Add(part);
}
Expand Down Expand Up @@ -201,7 +201,7 @@ private Partition[] GetPartitions()
if (!string.IsNullOrEmpty(this.PartitionFilter))
{
partitionFilter = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
foreach (var partName in this.PartitionFilter.Split(new char[] { ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries))
foreach (var partName in this.PartitionFilter.Split(new char[] { ',', ';' }, System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries))
{
partitionFilter.Add(partName);
}
Expand Down Expand Up @@ -278,7 +278,7 @@ private bool ProcessPartition(Partition partition, string arch)

if (this.AdditionalIncludes != null)
{
string[] dirs = this.AdditionalIncludes.Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] dirs = this.AdditionalIncludes.Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
foreach (var dir in dirs)
{
if (!includeDirHash.Contains(dir))
Expand Down Expand Up @@ -465,17 +465,17 @@ private bool ProcessPartition(Partition partition, string arch)

private string[] GetExclusions(ITaskItem item)
{
return item.GetMetadata("Exclude").Split(';', System.StringSplitOptions.RemoveEmptyEntries);
return item.GetMetadata("Exclude").Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
}

private string[] GetRemaps(ITaskItem item)
{
return item.GetMetadata("Remap").Split(';', System.StringSplitOptions.RemoveEmptyEntries);
return item.GetMetadata("Remap").Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
}

private string[] GetFilesFromMetadata(ITaskItem item, string name)
{
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
for (int i = 0; i < items.Length; i++)
{
if (!Path.IsPathRooted(items[i]))
Expand Down
2 changes: 1 addition & 1 deletion sources/GeneratorSdk/MetadataTasks/TaskUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static IEnumerable<string> GetFullPaths(IEnumerable<ITaskItem> items, str

public static IEnumerable<string> GetFilesFromMetadata(this ITaskItem item, string name, string root)
{
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries);
string[] items = item.GetMetadata(name).Split(';', System.StringSplitOptions.RemoveEmptyEntries | System.StringSplitOptions.TrimEntries);
for (int i = 0; i < items.Length; i++)
{
if (!Path.IsPathRooted(items[i]))
Expand Down

0 comments on commit c311d46

Please sign in to comment.