mirror of
https://github.com/sinbad/UEScripts.git
synced 2025-02-23 13:15:23 +00:00
Generalise the finding of sets of files
This commit is contained in:
parent
8328051da8
commit
b7a0fd4bbe
25
inc/filetools.ps1
Normal file
25
inc/filetools.ps1
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
function Find-File-Set {
|
||||||
|
param (
|
||||||
|
[string]$startDir,
|
||||||
|
[string]$pattern,
|
||||||
|
[bool]$includeByDefault,
|
||||||
|
[array]$includeBaseNames,
|
||||||
|
[array]$excludeBaseNames
|
||||||
|
)
|
||||||
|
|
||||||
|
$set = [System.Collections.Generic.HashSet[string]]::New()
|
||||||
|
Get-ChildItem -Path $startDir -Filter $pattern -Recurse | ForEach-Object {
|
||||||
|
if ($includeByDefault) {
|
||||||
|
if ($excludeBaseNames -notcontains $_.BaseName) {
|
||||||
|
$set.Add($_.BaseName) > $null
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($includeBaseNames -contains $_.BaseName) {
|
||||||
|
$set.Add($_.BaseName) > $null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $set
|
||||||
|
|
||||||
|
}
|
@ -28,6 +28,7 @@ param (
|
|||||||
. $PSScriptRoot\inc\uproject.ps1
|
. $PSScriptRoot\inc\uproject.ps1
|
||||||
. $PSScriptRoot\inc\ueinstall.ps1
|
. $PSScriptRoot\inc\ueinstall.ps1
|
||||||
. $PSScriptRoot\inc\ueeditor.ps1
|
. $PSScriptRoot\inc\ueeditor.ps1
|
||||||
|
. $PSScriptRoot\inc\filetools.ps1
|
||||||
|
|
||||||
|
|
||||||
function Write-Usage {
|
function Write-Usage {
|
||||||
@ -139,16 +140,7 @@ try {
|
|||||||
Write-Warning "Unknown variant(s) ignored: $($unmatchedVariants -join ", ")"
|
Write-Warning "Unknown variant(s) ignored: $($unmatchedVariants -join ", ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
$maps = [System.Collections.Generic.HashSet[string]]::New()
|
$maps = Find-File-Set -startDir:$(Join-Path $src "Content") -pattern:*.umap -includeByDefault:$config.CookAllMaps -includeBaseNames:$config.MapsIncluded -excludeBaseNames:$config.MapsExcluded
|
||||||
if ($config.CookAllMaps) {
|
|
||||||
Get-ChildItem -Path $(Join-Path $src "Content") -Filter *.umap -Recurse | ForEach-Object {
|
|
||||||
if ($config.MapsExcluded -notcontains $_.BaseName) {
|
|
||||||
$maps.Add($_.BaseName)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} elseif ($config.MapsIncluded) {
|
|
||||||
$config.MapsIncluded | ForEach-Object { $maps.Add($_) }
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output ""
|
Write-Output ""
|
||||||
Write-Output "Project File : $projfile"
|
Write-Output "Project File : $projfile"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user