Front end of the Slack clone application.

index.js 572B

1234567891011121314151617181920212223242526
  1. 'use strict';
  2. var isWindows = process.platform === 'win32';
  3. var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/;
  4. // https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43
  5. module.exports = function () {
  6. var path;
  7. if (isWindows) {
  8. path = process.env.TEMP ||
  9. process.env.TMP ||
  10. (process.env.SystemRoot || process.env.windir) + '\\temp';
  11. } else {
  12. path = process.env.TMPDIR ||
  13. process.env.TMP ||
  14. process.env.TEMP ||
  15. '/tmp';
  16. }
  17. if (trailingSlashRe.test(path)) {
  18. path = path.slice(0, -1);
  19. }
  20. return path;
  21. };