-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathactivate-env.ps1
More file actions
39 lines (34 loc) · 1.44 KB
/
Copy pathactivate-env.ps1
File metadata and controls
39 lines (34 loc) · 1.44 KB
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
36
37
38
39
function global:deactivate-env {
if (-not $env:TDO_DEVKIT_PATH) {
Write-Host "3DO development environment not activated."
return
}
$env:PATH = $env:PATH -replace [regex]::Escape(";$env:TDO_DEVKIT_PATH\bin\compiler\win"), ""
$env:PATH = $env:PATH -replace [regex]::Escape(";$env:TDO_DEVKIT_PATH\bin\tools\win"), ""
$env:PATH = $env:PATH -replace [regex]::Escape(";$env:TDO_DEVKIT_PATH\bin\buildtools\win"), ""
Remove-Item Env:\TDO_DEVKIT_PATH -ErrorAction SilentlyContinue
Write-Host "3DO development environment deactivated."
Remove-Item Function:deactivate-env -ErrorAction SilentlyContinue
}
if ($env:TDO_DEVKIT_PATH) {
# Use existing
}
elseif (Test-Path ".devkit-path") {
$env:TDO_DEVKIT_PATH = Get-Content ".devkit-path" -Raw
}
else {
$env:TDO_DEVKIT_PATH = (Split-Path -Path $MyInvocation.MyCommand.Path -Parent)
}
$env:PATH = "$env:PATH;$env:TDO_DEVKIT_PATH\bin\compiler\win"
$env:PATH = "$env:PATH;$env:TDO_DEVKIT_PATH\bin\tools\win"
$env:PATH = "$env:PATH;$env:TDO_DEVKIT_PATH\bin\buildtools\win"
if (Get-Command armcc -ErrorAction SilentlyContinue) {
Write-Host "3DO development environment activated. Run 'deactivate-env' to deactivate."
}
else {
Write-Host "Error: Activation failed. armcc not found in PATH."
if (Test-Path ".devkit-path") {
Write-Host "Note: .devkit-path contains: $env:TDO_DEVKIT_PATH"
Write-Host "If this path is wrong, update .devkit-path."
}
}