-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInstall-VSCodeConfigurator.ps1
35 lines (30 loc) · 1.37 KB
/
Install-VSCodeConfigurator.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
29
30
31
32
33
34
35
[CmdletBinding()]
param(
[Parameter(Position = 0)]
[ValidateSet(
"Release",
"Debug"
)]
[string]$Configuration = "Release"
)
$artifactPath = Join-Path -Path $PSScriptRoot -ChildPath "target/$($Configuration.ToLower())/vscode-configurator"
$templatesArtifactPath = Join-Path -Path $PSScriptRoot -ChildPath "target/$($Configuration.ToLower())/templates"
$installPath = Join-Path -Path ([System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::UserProfile)) -ChildPath ".vscodeconfigurator/bin/"
if (!(Test-Path -Path $artifactPath)) {
$PSCmdlet.ThrowTerminatingError(
[System.Management.Automation.ErrorRecord]::new(
[System.IO.FileNotFoundException]::new("Built executable not found at '$($artifactPath)'."),
"InstallerNotFound",
[System.Management.Automation.ErrorCategory]::ObjectNotFound,
$artifactPath
)
)
}
if (!(Test-Path -Path $installPath)) {
Write-Warning "Creating install directory at: $($installPath)"
$null = New-Item -Path $installPath -ItemType "Directory" -Force
}
Write-Verbose "Copying 'vscode-configurator' to: $($installPath)"
Copy-Item -Path $artifactPath -Destination $installPath -Force -Verbose:$false
Write-Verbose "Copying templates to: $($installPath)"
Copy-Item -Path $templatesArtifactPath -Destination $installPath -Recurse -Force -Verbose:$false