fix(perception): support worker powershell runtime
This commit is contained in:
@@ -114,10 +114,17 @@ function Write-Utf8NoBom([string]$Path, [string]$Value) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Get-DirectoryTreeSha256([string]$Root, [object[]]$Files) {
|
function Get-DirectoryTreeSha256([string]$Root, [object[]]$Files) {
|
||||||
|
$rootPrefix = $Root.TrimEnd("\") + "\"
|
||||||
$rows = @(
|
$rows = @(
|
||||||
foreach ($file in $Files) {
|
foreach ($file in $Files) {
|
||||||
|
if (-not $file.FullName.StartsWith(
|
||||||
|
$rootPrefix,
|
||||||
|
[StringComparison]::OrdinalIgnoreCase
|
||||||
|
)) {
|
||||||
|
throw "M4 dependency file escaped its declared root"
|
||||||
|
}
|
||||||
[pscustomobject]@{
|
[pscustomobject]@{
|
||||||
Relative = [IO.Path]::GetRelativePath($Root, $file.FullName).Replace("\", "/")
|
Relative = $file.FullName.Substring($rootPrefix.Length).Replace("\", "/")
|
||||||
File = $file
|
File = $file
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user