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

35 lines
1.0 KiB
PowerShell
Raw Permalink Normal View History

2023-03-31 15:56:07 +00:00
#Function to check if modification exists within 'mods' directory
2022-04-20 04:22:22 +00:00
2022-06-10 08:26:41 +00:00
function Test-Mods ($app) {
2022-04-20 04:22:22 +00:00
2022-04-20 18:54:10 +00:00
#Takes care of a null situation
2022-11-26 16:47:38 +00:00
$ModsPreInstall = $null
2022-12-08 16:53:37 +00:00
$ModsOverride = $null
2022-04-23 09:45:37 +00:00
$ModsUpgrade = $null
2022-12-04 00:55:40 +00:00
$ModsInstall = $null
$ModsInstalled = $null
2022-04-20 18:54:10 +00:00
$Mods = "$WorkingDir\mods"
2022-06-10 08:26:41 +00:00
if (Test-Path "$Mods\$app-*") {
2022-11-26 16:47:38 +00:00
if (Test-Path "$Mods\$app-preinstall.ps1") {
$ModsPreInstall = "$Mods\$app-preinstall.ps1"
}
2022-12-08 16:53:37 +00:00
if (Test-Path "$Mods\$app-override.txt") {
$ModsOverride = Get-Content "$Mods\$app-override.txt" -Raw
}
2022-06-10 08:26:41 +00:00
if (Test-Path "$Mods\$app-install.ps1") {
2022-04-20 18:54:10 +00:00
$ModsInstall = "$Mods\$app-install.ps1"
$ModsUpgrade = "$Mods\$app-install.ps1"
2022-04-20 09:30:04 +00:00
}
2022-06-10 08:26:41 +00:00
if (Test-Path "$Mods\$app-upgrade.ps1") {
2022-04-20 18:54:10 +00:00
$ModsUpgrade = "$Mods\$app-upgrade.ps1"
2022-04-20 09:30:04 +00:00
}
2022-12-04 00:55:40 +00:00
if (Test-Path "$Mods\$app-installed.ps1") {
$ModsInstalled = "$Mods\$app-installed.ps1"
}
2022-04-20 04:22:22 +00:00
}
2022-12-08 16:53:37 +00:00
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled
2022-04-23 09:45:37 +00:00
2022-04-20 18:54:10 +00:00
}