Fix compatibility with mixed new line characters

This commit is contained in:
Manuel Thalmann 2024-08-23 23:44:23 +02:00
parent d5c45fafc7
commit 975430d97e

View file

@ -51,6 +51,7 @@ function Write-PSScript {
Import-Module PSScriptAnalyzer; Import-Module PSScriptAnalyzer;
$dirName = Split-Path -Parent $FileName; $dirName = Split-Path -Parent $FileName;
$Script = ($Script -split "\r?\n") -join [System.Environment]::NewLine;
$content = Invoke-Formatter -ScriptDefinition $Script; $content = Invoke-Formatter -ScriptDefinition $Script;
$exists = Test-Path -PathType Leaf $FileName; $exists = Test-Path -PathType Leaf $FileName;