source: imaps-frontend/node_modules/resolve/lib/homedir.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 805 bytes
Line 
1'use strict';
2
3var os = require('os');
4
5// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js
6
7module.exports = os.homedir || function homedir() {
8 var home = process.env.HOME;
9 var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME;
10
11 if (process.platform === 'win32') {
12 return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null;
13 }
14
15 if (process.platform === 'darwin') {
16 return home || (user ? '/Users/' + user : null);
17 }
18
19 if (process.platform === 'linux') {
20 return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens
21 }
22
23 return home || null;
24};
Note: See TracBrowser for help on using the repository browser.