Skip to content

Commit

Permalink
Add Recurse parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyBazhan committed Jan 8, 2021
1 parent 73e647a commit 170a914
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Tools/Symbols/Symbols.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Function Add-ImageFile(
$Null = New-Item -Path $Destination -ItemType Directory
}

Write-Output "Copying $FilePath to $Destination"
Write-Output "Copying $FilePath to $Destination\$FileName"

Copy-Item -Path $FilePath -Destination $Destination
}
Expand All @@ -125,10 +125,16 @@ Function Add-ImageFile(
Function Add-ImageFiles(
[Parameter(Mandatory = $True)] [String] $Path,
[Parameter(Mandatory = $True)] [String] $Destination,
[Parameter(Mandatory = $False)] [String[]] $Include = @("*.exe", "*.dll", "*.sys")
[Parameter(Mandatory = $False)] [String[]] $Include = @("*.exe", "*.dll", "*.sys"),
[Parameter(Mandatory = $False)] [Switch] $Recurse
)
{
$Files = Get-ChildItem -Path $Path -Include $Include -File -Recurse
if (!$Recurse) {

$Path = [System.IO.Path]::Combine($Path, "*")
}

$Files = Get-ChildItem -Path $Path -Include $Include -File -Recurse:$Recurse

foreach ($File in $Files) {

Expand Down Expand Up @@ -171,16 +177,16 @@ Function New-HeaderFile(
$FileName = Split-Path -Path $FilePath -Leaf
$FileName = "$FileName-$FileVersion-$Architecture.h"

$OutFile = [System.IO.Path]::Combine($Destination, $FileName)
$HeaderFile = [System.IO.Path]::Combine($Destination, $FileName)

if ((Test-Path $Destination) -eq $False) {

$Null = New-Item -Path $Destination -ItemType Directory
}

Write-Output $FileName
Write-Output "Creating $HeaderFile from $FilePath"

SymExp.exe $FilePath | Out-File -Encoding ASCII $OutFile
SymExp.exe $FilePath | Out-File -Encoding ASCII $HeaderFile
}
else {

Expand All @@ -194,10 +200,16 @@ Function New-HeaderFile(
Function New-HeaderFiles(
[Parameter(Mandatory = $True)] [String] $Path,
[Parameter(Mandatory = $True)] [String] $Destination,
[Parameter(Mandatory = $False)] [String[]] $Include = @("*.exe", "*.dll", "*.sys")
[Parameter(Mandatory = $False)] [String[]] $Include = @("*.exe", "*.dll", "*.sys"),
[Parameter(Mandatory = $False)] [Switch] $Recurse
)
{
$Files = Get-ChildItem -Path $Path -Include $Include -File -Recurse
if (!$Recurse) {

$Path = [System.IO.Path]::Combine($Path, "*")
}

$Files = Get-ChildItem -Path $Path -Include $Include -File -Recurse:$Recurse

foreach ($File in $Files) {

Expand Down

0 comments on commit 170a914

Please sign in to comment.