[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v6 01/11] Collapse skipped template lines



This is needed to correctly generate multiline INF directives.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 scripts/genfiles.ps1 | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/scripts/genfiles.ps1 b/scripts/genfiles.ps1
index 4c58f03..be12087 100644
--- a/scripts/genfiles.ps1
+++ b/scripts/genfiles.ps1
@@ -27,12 +27,15 @@ Function Copy-FileWithReplacements {
        ForEach-Object {
                $line = $_
                $Replacements.GetEnumerator() | ForEach-Object {
-                       $key = [string]::Format("{0}{1}{2}", $Token, $_.Name, 
$Token)
-                       if (([string]::IsNullOrEmpty($_.Value)) -and 
($line.Contains($key))) {
-                               Write-Host "Skipping Line Containing " $_.Name
-                               $line = $null
+                       if ($null -ne $line) {
+                               $key = [string]::Format("{0}{1}{2}", $Token, 
$_.Name, $Token)
+                               if (([string]::IsNullOrEmpty($_.Value)) -and 
($line.Contains($key))) {
+                                       Write-Host "Skipping Line Containing " 
$_.Name
+                                       $line = $null
+                               } else {
+                                       $line = $line -replace $key, $_.Value
+                               }
                        }
-                       $line = $line -replace $key, $_.Value
                }
                $line
        } |
-- 
2.50.1.windows.1



Ngoc Tu Dinh | Vates XCP-ng Developer

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.