Front end of the Slack clone application.

12345678910111213141516171819202122232425
  1. 'use strict';
  2. var os = require('os');
  3. function homedir() {
  4. var env = process.env;
  5. var home = env.HOME;
  6. var user = env.LOGNAME || env.USER || env.LNAME || env.USERNAME;
  7. if (process.platform === 'win32') {
  8. return env.USERPROFILE || env.HOMEDRIVE + env.HOMEPATH || home || null;
  9. }
  10. if (process.platform === 'darwin') {
  11. return home || (user ? '/Users/' + user : null);
  12. }
  13. if (process.platform === 'linux') {
  14. return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null));
  15. }
  16. return home || null;
  17. }
  18. module.exports = typeof os.homedir === 'function' ? os.homedir : homedir;