mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -06:00
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:
parent
0fb067a4b8
commit
d67415f6ac
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user