Files
OpenRCT2-Web/scripts/ps/common.psm1
T

29 lines
928 B
PowerShell
Raw Normal View History

2015-12-10 00:13:20 +00:00
#########################################################
# Common functions for OpenRCT2 PowerShell scripts
#########################################################
2015-12-12 18:55:10 +00:00
$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path
2015-12-12 19:41:54 +00:00
function AppExists($app)
{
$result = (Get-Command $app -CommandType Application -ErrorAction SilentlyContinue)
return ($result -ne $null -and $result.Count -gt 0)
}
function AddPath($path)
{
$env:path = "$path;$env:path"
}
2015-12-12 18:55:10 +00:00
function Get-RootPath()
{
return Split-Path (Split-Path $scriptsPath)
}
2015-12-10 00:13:20 +00:00
function Prompt-User($message)
{
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$choice = $host.UI.PromptForChoice("", $message, $options, 1)
return ($choice -eq 0)
}