()
| 39 | //@ Searches and returns string containing a writeable, platform-dependent temporary directory. |
| 40 | //@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir). |
| 41 | function _tempDir() { |
| 42 | if (cachedTempDir) return cachedTempDir; |
| 43 | |
| 44 | cachedTempDir = writeableDir(os.tmpdir()) || |
| 45 | writeableDir(process.env.TMPDIR) || |
| 46 | writeableDir(process.env.TEMP) || |
| 47 | writeableDir(process.env.TMP) || |
| 48 | writeableDir(process.env.Wimp$ScrapDir) || // RiscOS |
| 49 | writeableDir('C:\\TEMP') || // Windows |
| 50 | writeableDir('C:\\TMP') || // Windows |
| 51 | writeableDir('\\TEMP') || // Windows |
| 52 | writeableDir('\\TMP') || // Windows |
| 53 | writeableDir('/tmp') || |
| 54 | writeableDir('/var/tmp') || |
| 55 | writeableDir('/usr/tmp') || |
| 56 | writeableDir('.'); // last resort |
| 57 | |
| 58 | return cachedTempDir; |
| 59 | } |
| 60 | |
| 61 | // Indicates if the tempdir value is currently cached. This is exposed for tests |
| 62 | // only. The return value should only be tested for truthiness. |
no test coverage detected
searching dependent graphs…