/*! * userdir v1.0.0 * A simple utility to get the cross-platform user home directory * (c) 2021-2023 saqqdy * Released under the MIT License. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var os = require('os'); function userdir() { const env = process.env; const home = env.HOME; const user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME; if (process.platform === 'win32') { return env.USERPROFILE || (env.HOMEDRIVE || '') + (env.HOMEPATH || '') || home || null; } if (process.platform === 'darwin') { return home || (user ? '/Users/' + user : null); } if (process.platform === 'linux') { if (home) return home;else if (process.getuid && process.getuid() === 0) return '/root';else if (user) return '/home/' + user; return null; } return home || null; } var index = typeof os.homedir === 'function' ? os.homedir : userdir; exports.default = index; exports.userdir = userdir;