"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/os-tmpdir/index.js" (11 Apr 2017, 572 Bytes) of package /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    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 };