5252#>
5353param (
5454 [String ] $App = ' *' ,
55- [Parameter (Mandatory = $true )]
5655 [ValidateScript ( {
5756 if (! (Test-Path $_ - Type Container)) {
5857 throw " $_ is not a directory!"
@@ -77,8 +76,16 @@ param(
7776. " $PSScriptRoot \..\lib\install.ps1" # needed for hash generation
7877. " $PSScriptRoot \..\lib\unix.ps1"
7978
80- $Dir = Resolve-Path $Dir
81- $Search = $App
79+ if ($App -ne ' *' -and (Test-Path $App - PathType Leaf)) {
80+ $Dir = Split-Path $App
81+ $files = Get-ChildItem $Dir (Split-Path $App - Leaf)
82+ } elseif ($Dir ) {
83+ $Dir = Resolve-Path $Dir
84+ $files = Get-ChildItem $Dir " $App .json"
85+ } else {
86+ throw " '-Dir' parameter required if '-App' is not a filepath!"
87+ }
88+
8289$GitHubToken = Get-GitHubToken
8390
8491# don't use $Version with $App = '*'
@@ -89,17 +96,16 @@ if ($App -eq '*' -and $Version -ne '') {
8996# get apps to check
9097$Queue = @ ()
9198$json = ' '
92- Get-ChildItem $Dir " $App .json " | ForEach-Object {
99+ $files | ForEach-Object {
93100 $json = parse_json " $Dir \$ ( $_.Name ) "
94101 if ($json.checkver ) {
95102 $Queue += , @ ($_.Name , $json )
96103 }
97104}
98105
99106# clear any existing events
100- Get-Event | ForEach-Object {
101- Remove-Event $_.SourceIdentifier
102- }
107+ Get-Event | Remove-Event
108+ Get-EventSubscriber | Unregister-Event
103109
104110# start all downloads
105111$Queue | ForEach-Object {
0 commit comments