Replace Tabs with Spaces to follow the conventions - Make 'ExcludedFiles' validation step check all filepaths before finally checking if any has failed

This commit is contained in:
Mr.k 2024-07-29 06:53:20 +03:00
parent 0fb067a4b8
commit d67415f6ac
No known key found for this signature in database

View File

@ -72,13 +72,19 @@
throw "[Invoke-Preprocessing] Invalid Paramter Value for 'WorkingDir', passed value: '$WorkingDir'. Either the path is a File or Non-Existing/Invlid, please double check your code."
}
if ((-NOT ($ExcludedFiles.Count -eq 0)) -AND (-NOT $SkipExcludedFilesValidation)) {
ForEach ($excludedFile in $ExcludedFiles) {
$count = $ExcludedFiles.Count
if ((-NOT ($count -eq 0)) -AND (-NOT $SkipExcludedFilesValidation)) {
for ($i = 0; $i -lt $count; $i++) {
$excludedFile = $ExcludedFiles[$i]
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
if (-NOT (Get-ChildItem -Recurse -Path "$filePath" -File)) {
throw "[Invoke-Preprocessing] File Path & File Pattern was not found '$filePath', use '-SkipExcludedFilesValidation' switch to skip this check."
$failedFilesList += "'$filePath', "
}
}
$failedFilesList = $failedFilesList -replace (',\s*$', '')
if (-NOT $failedFilesList -eq "") {
throw "[Invoke-Preprocessing] One or more File Paths & File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, and the failed files are: $failedFilesList"
}
}
$files = Get-ChildItem $WorkingDir -Recurse -Exclude $ExcludedFiles -File