haskell / directory

Platform-independent library for basic file system operations
https://hackage.haskell.org/package/directory
Other
58 stars 47 forks source link

TMPDIR environment variable not honoured on windows #153

Closed mpickering closed 1 year ago

mpickering commented 1 year ago

The TMPDIR variable on linux influences the value returned by getTemporaryDirectory but not on windows.

module Main where

import System.Directory

main = getTemporaryDirectory >>= print

on linux

[nix-shell:~/ghc-clean]$ TMPDIR=$PWD ./TempDir 
"/home/matt/ghc-clean"

but on windows the variable is ignored.

GHC Issues: https://gitlab.haskell.org/ghc/ghc/-/issues/23348

sheaf commented 1 year ago

Windows uses the TMP/TEMP environment variables instead, and that's documented in the library.

mpickering commented 1 year ago

Yes that is documented, it seems to be a documentation bug in GHC. Sorry for the confusion.