2023-09-15 14:33:51 +00:00
|
|
|
# Function to check if modification exists within 'mods' directory
|
2022-04-20 04:22:22 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
function Test-Mods
|
|
|
|
{
|
|
|
|
# Takes care of a null situation
|
|
|
|
[CmdletBinding()]
|
|
|
|
param
|
|
|
|
(
|
|
|
|
[string]$app
|
|
|
|
)
|
2022-04-20 04:22:22 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
$ModsPreInstall = $null
|
|
|
|
$ModsOverride = $null
|
|
|
|
$ModsUpgrade = $null
|
|
|
|
$ModsInstall = $null
|
|
|
|
$ModsInstalled = $null
|
|
|
|
$Mods = ('{0}\mods' -f $WorkingDir)
|
|
|
|
|
|
|
|
if (Test-Path -Path ('{0}\{1}-*' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
if (Test-Path -Path ('{0}\{1}-preinstall.ps1' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$ModsPreInstall = ('{0}\{1}-preinstall.ps1' -f $Mods, $app)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Test-Path -Path ('{0}\{1}-override.txt' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$ModsOverride = Get-Content -Path ('{0}\{1}-override.txt' -f $Mods, $app) -Raw
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Test-Path -Path ('{0}\{1}-install.ps1' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$ModsInstall = ('{0}\{1}-install.ps1' -f $Mods, $app)
|
|
|
|
$ModsUpgrade = ('{0}\{1}-install.ps1' -f $Mods, $app)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Test-Path -Path ('{0}\{1}-upgrade.ps1' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$ModsUpgrade = ('{0}\{1}-upgrade.ps1' -f $Mods, $app)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Test-Path -Path ('{0}\{1}-installed.ps1' -f $Mods, $app) -ErrorAction SilentlyContinue)
|
|
|
|
{
|
|
|
|
$ModsInstalled = ('{0}\{1}-installed.ps1' -f $Mods, $app)
|
|
|
|
}
|
|
|
|
}
|
2022-04-23 09:45:37 +00:00
|
|
|
|
2023-09-15 14:33:51 +00:00
|
|
|
return $ModsPreInstall, $ModsOverride, $ModsUpgrade, $ModsInstall, $ModsInstalled
|
2022-04-20 18:54:10 +00:00
|
|
|
}
|