MCPcopy
hub / github.com/shelljs/shelljs / _tempDir

Function _tempDir

src/tempdir.js:41–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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).
41function _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.

Callers 1

execSyncFunction · 0.85

Calls 1

writeableDirFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…