Skip to content

Commit c418fe9

Browse files
authored
Simples fixes to 'Compile.ps1' Script (#2971)
* Save WinUtil's json strings with DOS-Style Newline Character (CRLF) instead of Unix-Style Newline Character (LF) Originated from PR #2816 by @ruxunderscore * Exit Early when facing Syntax Errors, Solves a problem when passing '-Run' Argument with 'Compile.ps1' Script - Use 'Out-Null' to follow common project conventions
1 parent d619ee7 commit c418fe9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Compile.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ $($jsonAsObject | ConvertTo-Json -Depth 3)
9191
"@
9292

9393
$sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json
94-
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`n$json`n'@ `| ConvertFrom-Json" ))
94+
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`r`n$json`r`n'@ `| ConvertFrom-Json" ))
9595
}
9696

9797
# Read the entire XAML file as a single string, preserving line breaks
@@ -125,10 +125,12 @@ Write-Progress -Activity "Compiling" -Completed
125125

126126
Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0
127127
try {
128-
$null = Get-Command -Syntax .\winutil.ps1
128+
Get-Command -Syntax .\winutil.ps1 | Out-Null
129129
} catch {
130130
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
131131
Write-Host "$($Error[0])" -ForegroundColor Red
132+
Pop-Location # Restore previous location before exiting...
133+
exit 1
132134
}
133135
Write-Progress -Activity "Validating" -Completed
134136

0 commit comments

Comments
 (0)