feat: install.ps1 -Reload, switch layout at the end, document the junction reload
Co-Authored-By: Ovis Fast (Claude) <[email protected]>
This commit is contained in:
1 parent
65b66f86cd
commit
cb7f7b58f5
2 files changed
+37
-4
No files matched your search
+22
-1
@@ -2,11 +2,16 @@
|
||||
#
|
||||
# .\scripts\install.ps1 install (idempotent)
|
||||
# .\scripts\install.ps1 -Uninstall remove the junction, restore backups
|
||||
# .\scripts\install.ps1 -Reload recreate the junction so Herdr loads the mod again
|
||||
#
|
||||
# Herdr does NOT see changes behind the junction on its own: after editing
|
||||
# mod\ovis-composer run -Reload (the junction is removed and made again, and
|
||||
# Herdr reloads the mod).
|
||||
#
|
||||
# Works on Windows PowerShell 5.
|
||||
|
||||
[CmdletBinding()]
|
||||
param([switch]$Uninstall)
|
||||
param([switch]$Uninstall, [switch]$Reload)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
@@ -65,6 +70,18 @@ function Install-KeyEntry {
|
||||
Write-Host "keys.json: $chord -> $action"
|
||||
}
|
||||
|
||||
if ($Reload) {
|
||||
if (-not (Test-Junction $Junction)) { throw "$Junction is not a junction - run install.ps1 first." }
|
||||
Remove-Junction $Junction
|
||||
if (-not (Test-Path -LiteralPath (Join-Path $ModSource 'main.js'))) {
|
||||
throw 'Repo files vanished after removing the junction - aborting.'
|
||||
}
|
||||
cmd /c mklink /J "`"$Junction`"" "`"$ModSource`"" | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) { throw 'mklink /J failed' }
|
||||
Write-Host "Junction recreated: $Junction -> $ModSource (Herdr loads the mod again)"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if ($Uninstall) {
|
||||
if (Test-Junction $Junction) {
|
||||
Remove-Junction $Junction
|
||||
@@ -131,3 +148,7 @@ Write-Host "Layout copied"
|
||||
|
||||
# 3. Key binding (Task 2).
|
||||
Install-KeyEntry
|
||||
|
||||
# 4. Show the layout.
|
||||
herdr-app do layout.switch '{"name":"ovis-composer"}'
|
||||
if ($LASTEXITCODE -ne 0) { Write-Warning "layout.switch to ovis-composer failed (exit $LASTEXITCODE) - switch the layout by hand." }
|
||||
Reference in new issue
Block a user