Private/ConvertTo-KadenGalleryRelativePath.ps1
|
function ConvertTo-KadenGalleryRelativePath { <# .SYNOPSIS Map a child-relative path to the Gallery package path. .DESCRIPTION Publish-Module omits path segments that start with a dot. Those segments are stored as dot-<name>. The child destination keeps the dotted name. scripts/maintainer/kaden-payload-map.ps1 uses this same rule for Payload. #> [CmdletBinding()] param( [Parameter(Mandatory = $true)] [string]$RelativePath ) $normalized = ($RelativePath -replace '\\', '/').Trim() return @( foreach ($segment in ($normalized -split '/')) { if ([string]::IsNullOrWhiteSpace($segment) -or $segment -eq '.') { continue } if ($segment -eq '..') { throw "Gallery relative path must not contain '..': $RelativePath" } if ($segment.StartsWith('.')) { 'dot-' + $segment.Substring(1) } else { $segment } } ) -join '/' } |