Skip to content

Commit

Permalink
(NuGet#9) Fix path separator in nuspec file element
Browse files Browse the repository at this point in the history
Converts the path separator character in the nuspec file source to the
character that is correct for the OS that is running the packing
operation. Changes "\" to "/" on Linux and MacOS systems, and
changes "/" to "\" on Windows systems.

Keeps chocolatey/choco#2166 fixed

Based on this commit:
chocolatey/nuget-chocolatey@979a47d
  • Loading branch information
TheCakeIsNaOH authored and gep13 committed Nov 21, 2022
1 parent 8b3d1b9 commit f11343c
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -456,14 +456,23 @@ private static List<ManifestFile> ReadFilesList(XElement xElement)
var target = file.GetOptionalAttributeValue("target").SafeTrim()?.TrimStart(slashes);
var exclude = file.GetOptionalAttributeValue("exclude").SafeTrim();

//////////////////////////////////////////////////////////
// Start - Chocolatey Specific Modification
//////////////////////////////////////////////////////////

// Multiple sources can be specified by using semi-colon separated values.
char separator = Path.DirectorySeparatorChar;
files.AddRange(srcElement.Value.Trim(';').Split(';').Select(s =>
new ManifestFile
{
Source = s.SafeTrim(),
Source = s.SafeTrim().Replace('/', separator).Replace('\u005c', separator),
Target = target,
Exclude = exclude
}));

//////////////////////////////////////////////////////////
// End - Chocolatey Specific Modification
//////////////////////////////////////////////////////////
}
return files;
}
Expand Down

0 comments on commit f11343c

Please sign in to comment.