Skip to content

Commit

Permalink
update windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
admercs committed Feb 20, 2024
1 parent 5809ace commit afba6dd
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions scripts/utils.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ function Test-VariableDefined {

function Test-WorkingDirectory {
[OutputType()]
param()
$WorkingDirectory = Split-Path "$PWD" -Leaf
if ($WorkingDirectory -ne 'AutonomySim') {
Write-Output "Present working directory: ${PWD}"
Expand All @@ -50,41 +51,40 @@ function Add-Directories {

function Remove-Directories {
[OutputType()]
param(
[Parameter()]
[String[]]
$Directories = @('temp', 'external')
)
foreach ($d in $Directories) {
Remove-Item -Path "$d" -Force -Recurse
}
param(
[Parameter()]
[String[]]
$Directories = @('temp', 'external')
)
foreach ($d in $Directories) {
Remove-Item -Path "$d" -Force -Recurse
}
}

function Invoke-Fail {
[OutputType()]
param(
[Parameter()]
[String]
$ProjectDir = "$PWD",
[Parameter()]
[Switch]
$RemoveDirs = $false,
[Parameter()]
[System.Exception]
$Exception,
[Parameter()]
[String]
$ErrorMessage
)
Set-Location "$ProjectDir"
if ($RemoveDirs -eq $true) { Remove-Directories }
if (Test-VariableDefined -Variable $ErrorMessage -eq $true) {
if (Test-VariableDefined -Variable $Exception -eq $true) {
([$Exception.GetType()]::new("$ErrorMessage"))
} else {
Write-Error "$ErrorMessage" -ErrorAction Continue
}
}
param(
[Parameter()]
[String]
$ProjectDir = "$PWD",
[Parameter()]
[Switch]
$RemoveDirs = $false,
[Parameter()]
[System.Exception]
$Exception,
[Parameter()]
[String]
$ErrorMessage
)
Set-Location "$ProjectDir"
if ($RemoveDirs -eq $true) { Remove-Directories }
if (Test-VariableDefined -Variable $ErrorMessage -eq $true) {
Write-Error -Exception [System.Exception] -Message "$ErrorMessage" -ErrorAction Continue
}
if (Test-VariableDefined -Variable $Exception -eq $true) {
throw $Exception
}
}

function Get-Exceptions {
Expand Down

0 comments on commit afba6dd

Please sign in to comment.