# ============================================================================ # enable-dev-mode.ps1 -- turn on dev mode for the launcher INSTALLED on this PC. # # The repo's dev-licence.json is a TEAM licence: it names no machine and no # install, and says so in its signed body (scope: team). Whoever can clone this # repo can run dev mode - repo access is the credential, deliberately, because # an operator has the installed launcher and never the source. # # A launcher started FROM this repo (npm run tauri dev) finds the licence by # itself: it looks beside its own exe and two levels up, which is this folder. # An INSTALLED launcher looks in its own install folder, so this script puts a # copy there. Run it once; then open Settings and the Dev section is there. # # powershell -ExecutionPolicy Bypass -File tools\enable-dev-mode.ps1 # ============================================================================ [CmdletBinding()] param([string]$InstallDir) $ErrorActionPreference = "Stop" $repo = Split-Path -Parent $PSScriptRoot $licence = Join-Path $repo "dev-licence.json" if (-not (Test-Path -LiteralPath $licence)) { throw "No dev-licence.json at the repo root ($licence)." } # Where ODIAN is installed: what the launcher's own settings say, else the usual place. if (-not $InstallDir) { $settings = Join-Path $env:APPDATA "fr.odian.launcher\settings.json" if (Test-Path -LiteralPath $settings) { $InstallDir = (Get-Content -LiteralPath $settings -Raw | ConvertFrom-Json).install_dir } } if (-not $InstallDir) { $InstallDir = if (Test-Path "D:\") { "D:\ODIAN" } else { "C:\ODIAN" } } if (-not (Test-Path -LiteralPath $InstallDir)) { throw "No ODIAN install at $InstallDir - pass -InstallDir." } $state = Join-Path $InstallDir "state" New-Item -ItemType Directory -Force -Path $state | Out-Null $target = Join-Path $state "dev-licence.json" Copy-Item -LiteralPath $licence -Destination $target -Force $expires = (Get-Content -LiteralPath $licence -Raw | ConvertFrom-Json).expires_at Write-Host "Dev mode licensed on this PC until $expires" -ForegroundColor Green Write-Host " $target" Write-Host "Restart the launcher, then Settings -> Dev -> point the checkout folder at the folder holding ODIAN_Engine."