Browse Source

Merge topic 'ci-windows-tmpdir'

f51d809b44 ci: Place temporary files inside job directory on Windows

Acked-by: Kitware Robot <[email protected]>
Merge-request: !9272
Brad King 1 year ago
parent
commit
62feb76394
2 changed files with 9 additions and 0 deletions
  1. 1 0
      .gitlab/.gitignore
  2. 8 0
      .gitlab/ci/env.ps1

+ 1 - 0
.gitlab/.gitignore

@@ -18,6 +18,7 @@
 /sccache*
 /sccache*
 /swift
 /swift
 /ticlang
 /ticlang
+/tmp
 /unstable-jom*
 /unstable-jom*
 /watcom
 /watcom
 /wix*
 /wix*

+ 8 - 0
.gitlab/ci/env.ps1

@@ -1,4 +1,12 @@
 $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
 $pwsh = [System.Diagnostics.Process]::GetCurrentProcess().MainModule.FileName
+
+# Place temporary files inside job directory.
+$tmp = New-Item -Force -ItemType Directory -Path "$pwd\.gitlab\tmp"
+$tmp = (New-Object -ComObject Scripting.FileSystemObject).GetFolder("$tmp").ShortPath
+Set-Item -Force -Path "env:TEMP" -Value "$tmp"
+Set-Item -Force -Path "env:TMP"  -Value "$tmp"
+$tmp = $null
+
 if (Test-Path -Path ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
 if (Test-Path -Path ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1" -PathType Leaf) {
   . ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1"
   . ".gitlab/ci/env_$env:CMAKE_CONFIGURATION.ps1"
 }
 }