(dir)
| 9 | |
| 10 | // Returns false if 'dir' is not a writeable directory, 'dir' otherwise |
| 11 | function writeableDir(dir) { |
| 12 | if (!dir || !fs.existsSync(dir)) return false; |
| 13 | |
| 14 | if (!common.statFollowLinks(dir).isDirectory()) return false; |
| 15 | |
| 16 | var testFile = dir + '/' + common.randomFileName(); |
| 17 | try { |
| 18 | fs.writeFileSync(testFile, ' '); |
| 19 | common.unlinkSync(testFile); |
| 20 | return dir; |
| 21 | } catch (e) { |
| 22 | /* istanbul ignore next */ |
| 23 | return false; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | // Variable to cache the tempdir value for successive lookups. |
| 28 | var cachedTempDir; |
no outgoing calls
no test coverage detected
searching dependent graphs…