~ chicken-core (chicken-5) b601e66126fbf02a7af4438e76c12b3134f87940


commit b601e66126fbf02a7af4438e76c12b3134f87940
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Fri Jun 21 09:15:14 2024 +0200
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Sun Jun 23 12:23:16 2024 +0200

    Fall back to %USERPROFILE%/AppData/Local/Temp on Windows for tempdir
    
    This is better than attempting to use /tmp, which wouldn't exist on
    Windows.

diff --git a/file.scm b/file.scm
index f8f45bd9..3448ec65 100644
--- a/file.scm
+++ b/file.scm
@@ -309,7 +309,12 @@ EOF
     (or (get-environment-variable "TMPDIR")
         (get-environment-variable "TEMP")
         (get-environment-variable "TMP")
-        "/tmp"))
+        (if ##sys#windows-platform
+            (let ((up (get-environment-variable "USERPROFILE")))
+              (if up
+                  (string-append up "/AppData/Local/Temp")
+                  "."))
+            "/tmp")))
   (set! create-temporary-file
     (lambda (#!optional (ext "tmp"))
       (##sys#check-string ext 'create-temporary-file)
Trap