Skip to content

Commit 8e0e264

Browse files
committed
fix: normalise AddContent path separators to forward slash on PS5.1
Get-ChildItem -Name returns backslash-separated paths on PS5.1 Windows. Manifest source/destination attributes now always use forward slashes for cross-platform consistency. Updates the test fixture accordingly (removing the $IsWindows separator branch, which was $null on PS5.1 anyway).
1 parent e3da88c commit 8e0e264

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

Plaster/Public/New-PlasterManifest.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ function New-PlasterManifest {
125125

126126
$fileAction = [ordered]@{
127127
'type' = 'file'
128-
'source' = $filename
129-
'destination' = $filename
128+
'source' = $filename.Replace('\', '/')
129+
'destination' = $filename.Replace('\', '/')
130130
}
131131
$jsonManifest.content += $fileAction
132132
}
@@ -162,11 +162,11 @@ function New-PlasterManifest {
162162
$fileElem = $manifest.CreateElement('file', $TargetNamespace)
163163

164164
$srcAttr = $manifest.CreateAttribute("source")
165-
$srcAttr.Value = $filename
165+
$srcAttr.Value = $filename.Replace('\', '/')
166166
$fileElem.Attributes.Append($srcAttr) > $null
167167

168168
$dstAttr = $manifest.CreateAttribute("destination")
169-
$dstAttr.Value = $filename
169+
$dstAttr.Value = $filename.Replace('\', '/')
170170
$fileElem.Attributes.Append($dstAttr) > $null
171171

172172
$manifest.plasterManifest["content"].AppendChild($fileElem) > $null

tests/New-PlasterManifest.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ Describe 'New-PlasterManifest Command Tests' {
142142
}
143143

144144
It 'AddContent parameter works' {
145-
$separator = if ($IsWindows) { "\" } else { "/" }
145+
$separator = "/"
146146
$expectedManifest = @"
147147
<?xml version="1.0" encoding="utf-8"?>
148148
<plasterManifest

0 commit comments

Comments
 (0)