Skip to content

Commit c9026c0

Browse files
fix(probe): support linux temp fallback for e1000 tool-service
1 parent 70f4bbc commit c9026c0

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,23 @@ function Resolve-CompilerRtArchive {
136136
return $null
137137
}
138138

139+
function Resolve-TemporaryRoot {
140+
$candidates = @(
141+
$env:TEMP,
142+
$env:TMPDIR,
143+
$env:TMP,
144+
[System.IO.Path]::GetTempPath()
145+
)
146+
147+
foreach ($candidate in $candidates) {
148+
if (-not [string]::IsNullOrWhiteSpace($candidate)) {
149+
return $candidate
150+
}
151+
}
152+
153+
throw 'Temporary directory is not available.'
154+
}
155+
139156
function Test-CompilerRtArchiveElf {
140157
param(
141158
[string] $ArchivePath
@@ -150,7 +167,7 @@ function Test-CompilerRtArchiveElf {
150167
return $false
151168
}
152169

153-
$scratchRoot = Join-Path $env:TEMP 'zar-zig-probe-compiler-rt'
170+
$scratchRoot = Join-Path (Resolve-TemporaryRoot) 'zar-zig-probe-compiler-rt'
154171
$scratchDir = Join-Path $scratchRoot ([System.Guid]::NewGuid().ToString('N'))
155172
New-Item -ItemType Directory -Force -Path $scratchDir | Out-Null
156173
try {

0 commit comments

Comments
 (0)