File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff 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+
139156function 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 {
You can’t perform that action at this time.
0 commit comments