forked from sirAndros/KeePassWinHello
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deploy-Plugin.ps1
28 lines (24 loc) · 1.07 KB
/
Deploy-Plugin.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
param (
[string] $ProjectDir = $null,
[string] $TargetDir = $null,
[switch] $ForDebug
)
if (!$PSScriptRoot) {
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}
if (!$ProjectDir) {
$ProjectDir = $PSScriptRoot
}
if (!$TargetDir) {
$keePassDir = Split-Path -Parent -Path (Get-Item "$ProjectDir\lib\KeePass.exe").Target
$TargetDir = Join-Path $keePassDir 'Plugins'
}
$packageOutDir = 'releases'
$binOutDir = 'src\bin\Debug'
if ($ForDebug) {
Join-Path $ProjectDir $packageOutDir | Get-ChildItem -Filter '*.plgx' | ForEach-Object { Join-Path $TargetDir $_.Name | Get-ChildItem -ErrorAction SilentlyContinue | Remove-Item }
Join-Path $ProjectDir $binOutDir | Get-ChildItem -Filter '*.dll' | Copy-Item -Destination $TargetDir -Force
} else {
Join-Path $ProjectDir $binOutDir | Get-ChildItem -Filter '*.dll' | ForEach-Object { Join-Path $TargetDir $_.Name | Get-ChildItem -ErrorAction SilentlyContinue | Remove-Item }
Join-Path $ProjectDir $packageOutDir | Get-ChildItem -Filter '*.plgx' | Copy-Item -Destination $TargetDir -Force
}