diff --git a/scripts/build.ps1 b/scripts/ps/build.ps1 similarity index 91% rename from scripts/build.ps1 rename to scripts/ps/build.ps1 index 085ebbf7c1..027985eb0b 100644 --- a/scripts/build.ps1 +++ b/scripts/ps/build.ps1 @@ -13,10 +13,13 @@ param ( [switch]$Rebuild = $false ) +# Setup +$ErrorActionPreference = "Stop" +$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path +Import-Module "$scriptsPath\common.psm1" -DisableNameChecking + # Get paths -$scriptPath = $Script:MyInvocation.MyCommand.Path -$scriptsPath = Split-Path $scriptPath -$rootPath = Split-Path $scriptsPath +$rootPath = Get-RootPath $binPath = Join-Path $rootPath "bin" $openrct2Path = Join-Path $binPath "openrct2.exe" diff --git a/scripts/common.psm1 b/scripts/ps/common.psm1 similarity index 79% rename from scripts/common.psm1 rename to scripts/ps/common.psm1 index 21552a3096..91fd987831 100644 --- a/scripts/common.psm1 +++ b/scripts/ps/common.psm1 @@ -1,6 +1,12 @@ ######################################################### # Common functions for OpenRCT2 PowerShell scripts ######################################################### +$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path + +function Get-RootPath() +{ + return Split-Path (Split-Path $scriptsPath) +} function Prompt-User($message) { diff --git a/scripts/install.ps1 b/scripts/ps/install.ps1 similarity index 88% rename from scripts/install.ps1 rename to scripts/ps/install.ps1 index c992070e6c..7fc57a43fa 100644 --- a/scripts/install.ps1 +++ b/scripts/ps/install.ps1 @@ -6,22 +6,21 @@ param ( ) Write-Host "Installing OpenRCT2 development environment for Windows" -ForegroundColor Cyan -# Settings -$libsUrl = "https://openrct2.website/files/orctlibs-vs.zip" +# Setup +$ErrorActionPreference = "Stop" +$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path +Import-Module "$scriptsPath\common.psm1" -DisableNameChecking -# Dependencies version (increment this when the dependencies is updated) +# Constants +$libsUrl = "https://openrct2.website/files/orctlibs-vs.zip" $libsVersion = 4 # Get paths -$scriptPath = $Script:MyInvocation.MyCommand.Path -$scriptsPath = Split-Path $scriptPath -$rootPath = Split-Path $scriptsPath +$rootPath = Get-RootPath $libsPath = Join-Path $rootPath "lib" $zipPath = Join-Path $libsPath "orctlibs.zip" $libsVersionPath = Join-Path $libsPath "libversion" -Import-Module "$scriptsPath\common.psm1" -DisableNameChecking - # Check if we need to update the dependencies $currentLibsVersion = 0 $updateLibs = $true diff --git a/scripts/publish.ps1 b/scripts/ps/publish.ps1 similarity index 93% rename from scripts/publish.ps1 rename to scripts/ps/publish.ps1 index 80bda7f64b..db3432f1fb 100644 --- a/scripts/publish.ps1 +++ b/scripts/ps/publish.ps1 @@ -9,10 +9,13 @@ param ( [string]$buildNo = "" ) +# Setup +$ErrorActionPreference = "Stop" +$scriptsPath = Split-Path $Script:MyInvocation.MyCommand.Path +Import-Module "$scriptsPath\common.psm1" -DisableNameChecking + # Get paths -$scriptPath = $Script:MyInvocation.MyCommand.Path -$scriptsPath = Split-Path $scriptPath -$rootPath = Split-Path $scriptsPath +$rootPath = Get-RootPath # Set build attributes function do-prepareSource($build_server = "", $build_number = "") diff --git a/scripts/run.ps1 b/scripts/ps/run.ps1 similarity index 100% rename from scripts/run.ps1 rename to scripts/ps/run.ps1 diff --git a/setenv.ps1 b/setenv.ps1 index 190e5ed457..d648edf23b 100644 --- a/setenv.ps1 +++ b/setenv.ps1 @@ -1,4 +1,6 @@ +########################################################### # Setups a PowerShell environment for OpenRCT2 development +########################################################### function AppExists($app) { @@ -12,7 +14,7 @@ function AddPath($path) } $rootPath = Split-Path $Script:MyInvocation.MyCommand.Path -$scriptsPath = "$rootPath\scripts" +$scriptsPath = "$rootPath\scripts\ps" Write-Host "Setting up OpenRCT2 development environment for Windows" -ForegroundColor Cyan $appExists = @{}