$ErrorActionPreference = "Stop"
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$appDest = Join-Path $env:LOCALAPPDATA "Programs\JournaLock-Demo"
$vaultDest = Join-Path ([Environment]::GetFolderPath("MyDocuments")) "JournaLock-Demo"
$prefDest = Join-Path $env:LOCALAPPDATA "JournaLock\JournaLock.Demo\Settings"
New-Item -ItemType Directory -Force $appDest, $vaultDest, $prefDest | Out-Null
Copy-Item (Join-Path $here "App\*") $appDest -Recurse -Force
Copy-Item (Join-Path $here "Vault\*") $vaultDest -Recurse -Force
Copy-Item (Join-Path $here "Settings\*") $prefDest -Force
$ws = New-Object -ComObject WScript.Shell
$lnk = $ws.CreateShortcut((Join-Path ([Environment]::GetFolderPath("Desktop")) "JL Demo.lnk"))
$lnk.TargetPath = Join-Path $appDest "JournaLock.exe"
$lnk.WorkingDirectory = $appDest
$lnk.Save()
Write-Host "Installed. Double-click JL Demo. PIN 2468."
