From eaa7a19118661a4dce72c818b95ff2d0be5f1bf9 Mon Sep 17 00:00:00 2001 From: Sean Wheeler Date: Sat, 26 Oct 2024 14:23:43 -0500 Subject: [PATCH] Fix bugs in New-HelpCabinetFile from OPS13 --- src/Microsoft.PowerShell.PlatyPS.psm1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.PowerShell.PlatyPS.psm1 b/src/Microsoft.PowerShell.PlatyPS.psm1 index 11fe439d..ebc7d2cf 100644 --- a/src/Microsoft.PowerShell.PlatyPS.psm1 +++ b/src/Microsoft.PowerShell.PlatyPS.psm1 @@ -248,8 +248,8 @@ function MakeHelpInfoXml { [xml] $HelpInfoContent = $xml } + $null = $HelpInfoContent.Save($outputFullPath) $outputItem = Get-Item $outputFullPath - $null = $HelpInfoContent.Save($outputItem.FullName) # return this to the caller $outputItem } @@ -260,7 +260,7 @@ function New-HelpCabinetFile { param( [parameter(Mandatory=$true)] [ValidateScript({(Test-Path $_ -PathType Container)})] - [string] $CabinetFilesFolder, + [string] $HelpFilesFolder, [parameter(Mandatory=$true)] [ValidateScript({(Test-Path $_ -PathType Leaf)})] @@ -307,22 +307,22 @@ function New-HelpCabinetFile { Assert-Command MakeCab.exe #Testing for files in source directory - if((Get-ChildItem -Path $CabinetFilesFolder).Count -le 0) { - throw "Path '${CabinetFilesFolder}' does not contain any files." + if((Get-ChildItem -Path $HelpFilesFolder).Count -le 0) { + throw "Path '${HelpFilesFolder}' does not contain any files." } #Testing for valid help file types $ValidHelpFileTypes = '.xml', '.txt' - $HelpFiles = Get-ChildItem -Path $CabinetFilesFolder -File + $HelpFiles = Get-ChildItem -Path $HelpFilesFolder -File $ValidHelpFiles = $HelpFiles | Where-Object { $_.Extension -in $ValidHelpFileTypes } $InvalidHelpFiles = $HelpFiles | Where-Object { $_.Extension -notin $ValidHelpFileTypes } if(-not $ValidHelpFiles) { - throw "No valid help files found in '${CabinetFilesFolder}'." + throw "No valid help files found in '${HelpFilesFolder}'." } if($InvalidHelpFiles) { $InvalidHelpFiles | ForEach-Object { - Write-Warning -Message "File '${$_}' is not a valid help file type. Excluding from Cab file." + Write-Warning -Message "File '$_' is not a valid help file type. Excluding from Cab file." } } @@ -393,7 +393,7 @@ function New-HelpCabinetFile { } } } - + $outputFiles } }