| 1 | diff --git a/rdmd/rdmd.d b/rdmd/rdmd.d |
| 2 | index 06f46d7..af22c35 100755 |
| 3 | --- a/rdmd/rdmd.d |
| 4 | +++ b/rdmd/rdmd.d |
| 5 | @@ -386,7 +386,13 @@ bool inALibrary(string source, string object) |
| 6 | |
| 7 | private @property string myOwnTmpDir() |
| 8 | { |
| 9 | - auto tmpRoot = userTempDir ? userTempDir : tempDir(); |
| 10 | + import std.file : empty, exists; |
| 11 | + import std.process : environment; |
| 12 | + |
| 13 | + string shellTemp = environment.get("TMPDIR"); |
| 14 | + string defaultTemp = !shellTemp.empty && shellTemp.exists ? shellTemp |
| 15 | + : tempDir(); |
| 16 | + auto tmpRoot = userTempDir ? userTempDir : defaultTemp; |
| 17 | version (Posix) |
| 18 | { |
| 19 | import core.sys.posix.unistd; |