Use Regex instead of parsing JsonObject

This commit is contained in:
Kevin Zhang 2021-06-28 11:03:09 +08:00 committed by GitHub
parent b729cb1c7d
commit cc9c51d899
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -50,10 +50,8 @@ function Delete-Unused ($path, $config) {
function Remove-CreateDumpExe ($path, $config) {
$target = "$path\Output\$config"
$depjson = Get-Content $target\Flow.Launcher.deps.json -raw |ConvertFrom-Json -depth 32
$depjson.targets.'.NETCoreApp,Version=v5.0/win-x64'.'runtimepack.Microsoft.NETCore.App.Runtime.win-x64/5.0.6'.native.PSObject.Properties.Remove("createdump.exe")
$depjson|ConvertTo-Json -Depth 32|Out-File $target\Flow.Launcher.deps.json
Remove-Item -Path $target -Include "*createdump.exe" -Recurse
$depjson = Get-Content $target\Flow.Launcher.deps.json -raw
$depjson -replace '(?s)(.createdump.exe": {.*?}.*?\n)\s*', "" | Out-File $target\Flow.Launcher.deps.json
}
@ -127,4 +125,4 @@ function Main {
}
}
Main
Main