Initial Brogether prototype
This commit is contained in:
41
scripts/install-local.ps1
Normal file
41
scripts/install-local.ps1
Normal file
@@ -0,0 +1,41 @@
|
||||
param(
|
||||
[string]$BrotatoDir = "C:\Program Files (x86)\Steam\steamapps\common\Brotato",
|
||||
[string]$WorkshopItemId = "",
|
||||
[string]$Version = "0.1.0"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
$packageScript = Join-Path $PSScriptRoot "package.ps1"
|
||||
$zipPath = Join-Path $root "dist\Brogether-Brogether-$Version.zip"
|
||||
$legacyModsDir = Join-Path $BrotatoDir "mods"
|
||||
$steamAppsDir = Split-Path -Parent (Split-Path -Parent $BrotatoDir)
|
||||
$workshopContentDir = Join-Path $steamAppsDir "workshop\content\1942280"
|
||||
|
||||
& $packageScript -Version $Version
|
||||
|
||||
if (-not (Test-Path $workshopContentDir)) {
|
||||
throw "Workshop content folder not found: $workshopContentDir"
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($WorkshopItemId)) {
|
||||
$workshopItem = Get-ChildItem -Path $workshopContentDir -Directory |
|
||||
Where-Object { $_.Name -match '^\d+$' } |
|
||||
Select-Object -First 1
|
||||
|
||||
if ($null -eq $workshopItem) {
|
||||
throw "No subscribed Brotato workshop folder found in $workshopContentDir. Subscribe to any Brotato workshop mod once, then rerun this script."
|
||||
}
|
||||
} else {
|
||||
$workshopItem = Get-Item -LiteralPath (Join-Path $workshopContentDir $WorkshopItemId) -ErrorAction Stop
|
||||
}
|
||||
|
||||
Get-ChildItem -Path $workshopContentDir -Recurse -Filter "Brogether-Brogether-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
|
||||
Get-ChildItem -Path $workshopContentDir -Recurse -Filter "PotatoConnect-PotatoConnect-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
|
||||
Get-ChildItem -Path $legacyModsDir -Filter "Brogether-Brogether-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
|
||||
Get-ChildItem -Path $legacyModsDir -Filter "PotatoConnect-PotatoConnect-*.zip" -ErrorAction SilentlyContinue | Remove-Item -Force
|
||||
Copy-Item -LiteralPath $zipPath -Destination (Join-Path $workshopItem.FullName (Split-Path -Leaf $zipPath)) -Force
|
||||
|
||||
Write-Host "Installed to workshop item folder $($workshopItem.FullName)"
|
||||
Write-Host "Start Brotato from Steam, then use F6 on host and F7 on client."
|
||||
Reference in New Issue
Block a user