-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup_env.ps1
29 lines (24 loc) · 1.52 KB
/
setup_env.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
function BootstrapEnv {
$WorkDir = Split-Path -Path $Script:MyInvocation.MyCommand.Path -Parent
# $WorkDir = Split-Path $MyInvocation.MyCommand.Path
Write-Host ">> Cleaning up environment"
Remove-Item "$WorkDir\out" -Recurse -ErrorAction SilentlyContinue
Remove-Item "$WorkDir\.venv" -Recurse -ErrorAction SilentlyContinue
if (Test-Path "$WorkDir\.vscode") {
$DotCodeFolderNonLinkFileCount = (Get-ChildItem "$WorkDir\.vscode" -File | Where-Object { -not $_.Attributes.HasFlag([System.IO.FileAttributes]::ReparsePoint) } | Measure-Object).Count
if ($DotCodeFolderNonLinkFileCount -ne 0) {
Write-Host "It seems like there are files that are directly added to the virtual folder. Not proceeding."
Get-ChildItem "$WorkDir\.vscode" -File
return 1
}
Remove-Item "$WorkDir\.vscode" -Recurse -ErrorAction SilentlyContinue
}
Write-Host ">> Symlinking vscode settings"
New-Item -ItemType Directory -Path "$WorkDir\.vscode" -Force | Out-Null
New-Item -ItemType SymbolicLink -Path "$WorkDir\.vscode\launch.json" -Value "$WorkDir\vscode\dotFiles_launch.json" -Force | Out-Null
New-Item -ItemType SymbolicLink -Path "$WorkDir\.vscode\settings.json" -Value "$WorkDir\vscode\dotFiles_settings.json" -Force | Out-Null
New-Item -ItemType SymbolicLink -Path "$WorkDir\.vscode\extensions.json" -Value "$WorkDir\vscode\dotFiles_extensions.json" -Force | Out-Null
Write-Host ">> Launching workspace 'code $WorkDir'"
code $WorkDir
}
BootstrapEnv