From 00668755c94c8c16c5210afa913c69aa4583fccb Mon Sep 17 00:00:00 2001 From: Rux Date: Tue, 10 Sep 2024 12:24:53 -0700 Subject: [PATCH] Modify `Compile.ps1` Handling of Xaml to Improve Maintainability (#2701) --- Compile.ps1 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Compile.ps1 b/Compile.ps1 index b7a61558..83be2406 100644 --- a/Compile.ps1 +++ b/Compile.ps1 @@ -93,11 +93,17 @@ Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach- $script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" )) } -$xaml = (Get-Content "xaml\inputXML.xaml").replace("'","''") +# Read the entire XAML file as a single string, preserving line breaks +$xaml = Get-Content "$workingdir\xaml\inputXML.xaml" -Raw Update-Progress "Adding: Xaml " 90 -$script_content.Add($(Write-output "`$inputXML = '$xaml'")) +# Add the XAML content to $script_content using a here-string +$script_content.Add(@" +`$inputXML = @' +$xaml +'@ +"@) $script_content.Add($(Get-Content "scripts\main.ps1"))