From c5b7b06db1810cbbb7aa596a200d2c0c0439386b Mon Sep 17 00:00:00 2001 From: "VRTINY\\DIS" Date: Wed, 27 Nov 2024 15:26:43 +0100 Subject: [PATCH] Auto-enable the venv and PATH settings in vscode on Windows. Backport candidate. --- .vscode/settings.json | 25 ++++++++++++++++++++++++- scripts/activate.ps1 | 5 +++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index f9a43c5..dd793dc 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -107,5 +107,28 @@ "text_encoding": "cpp", "execution": "cpp" }, - "cmake.ctest.allowParallelJobs": true + "cmake.ctest.allowParallelJobs": true, + "terminal.integrated.profiles.windows": { + + "PowerShell": { + "source": "PowerShell", + "icon": "terminal-powershell", + "args": [ + "-noexit", + "-file", + "${workspaceFolder}\\scripts\\activate.ps1" + ] + }, + "Command Prompt": { + "path": [ + "${env:windir}\\Sysnative\\cmd.exe", + "${env:windir}\\System32\\cmd.exe" + ], + "args": [], + "icon": "terminal-cmd" + }, + "Git Bash": { + "source": "Git Bash" + } + } } \ No newline at end of file diff --git a/scripts/activate.ps1 b/scripts/activate.ps1 index 20fad7e..e6d8dea 100644 --- a/scripts/activate.ps1 +++ b/scripts/activate.ps1 @@ -22,6 +22,11 @@ if (Test-Path -Path $candidate1BinDir) { $binDir = $buildDir + "\bin" } Write-Output "binDir = " + $binDir +$binDirExists = Test-Path $binDir +if (-Not $binDirExists) { + Write-Output "binDir does not exist. Not enabling venv" + exit +} $Env:CWIPC_LIBRARY_DIR = $binDir $Env:PATH = $binDir + ";" + $Env:PATH Write-Output $Env:PATH