From 974c46cc1e2d0f5a43ff6494f6b5068256e04c9f Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Wed, 23 Oct 2024 17:56:42 +0300 Subject: [PATCH 1/2] Save WinUtil's json strings with DOS-Style Newline Character (CRLF) instead of Unix-Style Newline Character (LF) Originated from PR #2816 by @ruxunderscore --- Compile.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compile.ps1 b/Compile.ps1 index f427e355..98257848 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -91,7 +91,7 @@ $($jsonAsObject | ConvertTo-Json -Depth 3) "@ $sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json - $script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`n$json`n'@ `| ConvertFrom-Json" )) + $script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`r`n$json`r`n'@ `| ConvertFrom-Json" )) } # Read the entire XAML file as a single string, preserving line breaks From 5641623b1e1deb79b0e787d3ae1f4ce6c4796001 Mon Sep 17 00:00:00 2001 From: "Mr.k" Date: Wed, 23 Oct 2024 18:00:25 +0300 Subject: [PATCH 2/2] 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 --- Compile.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Compile.ps1 b/Compile.ps1 index 98257848..e011b6b5 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -125,10 +125,12 @@ Write-Progress -Activity "Compiling" -Completed Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0 try { - $null = Get-Command -Syntax .\winutil.ps1 + Get-Command -Syntax .\winutil.ps1 | Out-Null } catch { Write-Warning "Syntax Validation for 'winutil.ps1' has failed" Write-Host "$($Error[0])" -ForegroundColor Red + Pop-Location # Restore previous location before exiting... + exit 1 } Write-Progress -Activity "Validating" -Completed