wingetautoupdate/Sources/WAU/Winget-AutoUpdate/functions/Test-Mods.ps1

44 lines
1.3 KiB
PowerShell
Raw Normal View History

#Function to check if modification exists within 'mods' directory
function Test-Mods ($app) {
#Takes care of a null situation
$ModsPreInstall = $null
$ModsOverride = $null
$ModsUpgrade = $null
$ModsInstall = $null
$ModsInstalled = $null
2023-11-25 21:39:37 +00:00
$ModsNotInstalled = $null
$Mods = "$WorkingDir\mods"
2023-11-25 21:39:37 +00:00
if (Test-Path "$Mods\_WAU-notinstalled.ps1") {
$ModsNotInstalled = "$Mods\_WAU-notinstalled.ps1"
}
if (Test-Path "$Mods\$app-*") {
if (Test-Path "$Mods\$app-preinstall.ps1") {
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
}
if (Test-Path "$Mods\$app-override.txt") {
$ModsOverride = Get-Content "$Mods\$app-override.txt" -Raw
}
if (Test-Path "$Mods\$app-install.ps1") {
$ModsInstall = "$Mods\$app-install.ps1"
$ModsUpgrade = "$Mods\$app-install.ps1"
}
if (Test-Path "$Mods\$app-upgrade.ps1") {
$ModsUpgrade = "$Mods\$app-upgrade.ps1"
}
if (Test-Path "$Mods\$app-installed.ps1") {
$ModsInstalled = "$Mods\$app-installed.ps1"
}
2023-11-24 18:33:35 +00:00
if (Test-Path "$Mods\$app-notinstalled.ps1") {
$ModsNotInstalled = "$Mods\$app-notinstalled.ps1"
}
}
2023-11-24 18:33:35 +00:00
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled, $ModsNotInstalled
2022-04-20 04:22:22 +00:00
2022-04-20 18:54:10 +00:00
}