management/front/dkha-web-sz-main/node_modules/user-home/index.js

16 lines
547 B
JavaScript
Raw Normal View History

2023-12-18 13:12:25 +08:00
'use strict';
var env = process.env;
var home = env.HOME;
var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
if (process.platform === 'win32') {
module.exports = env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
} else if (process.platform === 'darwin') {
module.exports = home || (user ? '/Users/' + user : null) || null;
} else if (process.platform === 'linux') {
module.exports = home ||
(user ? (process.getuid() === 0 ? '/root' : '/home/' + user) : null) || null;
} else {
module.exports = home || null;
}