Last change
on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
572 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 'use strict';
|
---|
| 2 | var isWindows = process.platform === 'win32';
|
---|
| 3 | var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
|
---|
| 4 |
|
---|
| 5 | // https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43
|
---|
| 6 | module.exports = function () {
|
---|
| 7 | var path;
|
---|
| 8 |
|
---|
| 9 | if (isWindows) {
|
---|
| 10 | path = process.env.TEMP ||
|
---|
| 11 | process.env.TMP ||
|
---|
| 12 | (process.env.SystemRoot || process.env.windir) + '\\temp';
|
---|
| 13 | } else {
|
---|
| 14 | path = process.env.TMPDIR ||
|
---|
| 15 | process.env.TMP ||
|
---|
| 16 | process.env.TEMP ||
|
---|
| 17 | '/tmp';
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | if (trailingSlashRe.test(path)) {
|
---|
| 21 | path = path.slice(0, -1);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | return path;
|
---|
| 25 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.