42 lines
1.2 KiB
PowerShell
42 lines
1.2 KiB
PowerShell
|
|
param(
|
||
|
|
[Parameter(Mandatory=$true)]
|
||
|
|
[string]$SdkRoot,
|
||
|
|
|
||
|
|
[string]$ReleaseDir = (Get-Location).Path,
|
||
|
|
|
||
|
|
[switch]$OverwriteConfig
|
||
|
|
)
|
||
|
|
|
||
|
|
$ErrorActionPreference = "Stop"
|
||
|
|
|
||
|
|
$sdk = (Resolve-Path $SdkRoot).Path
|
||
|
|
$release = (Resolve-Path $ReleaseDir).Path
|
||
|
|
|
||
|
|
$binDir = Join-Path $sdk "bin"
|
||
|
|
$configDir = Join-Path $sdk "config"
|
||
|
|
$appConfig = Join-Path $configDir "app_config.json"
|
||
|
|
$publicKey = Join-Path $configDir "manifest_public_key.pem"
|
||
|
|
|
||
|
|
foreach ($path in @($binDir, $appConfig, $publicKey)) {
|
||
|
|
if (-not (Test-Path $path)) {
|
||
|
|
throw "SDK file is missing: $path"
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
Copy-Item (Join-Path $binDir "*") $release -Recurse -Force
|
||
|
|
|
||
|
|
$targetConfigDir = Join-Path $release "config"
|
||
|
|
New-Item $targetConfigDir -ItemType Directory -Force | Out-Null
|
||
|
|
|
||
|
|
$targetAppConfig = Join-Path $targetConfigDir "app_config.json"
|
||
|
|
if ((-not (Test-Path $targetAppConfig)) -or $OverwriteConfig) {
|
||
|
|
Copy-Item $appConfig $targetAppConfig -Force
|
||
|
|
} else {
|
||
|
|
Write-Host "Keep existing config/app_config.json. Use -OverwriteConfig to replace it."
|
||
|
|
}
|
||
|
|
|
||
|
|
Copy-Item $publicKey (Join-Path $targetConfigDir "manifest_public_key.pem") -Force
|
||
|
|
|
||
|
|
Write-Host "SDK files installed to: $release"
|
||
|
|
Write-Host "Next: edit config/app_config.json, then start Launcher.exe."
|