Returns home directory of the current user.

Note: This directory is only used for Hadoop purposes.
It is not the same as a user's OS home directory.
765497
@Override
  public Path getHomeDirectory() {
    Path result = new Path(getFileSystemRoot(), getHomeDirectorySubpath());
    logger.atFine().log("GHFS.getHomeDirectory:=> %s", result);
    return result;
  }
28764
public static File getUserHomeDir() {
        final String errMsg = "System property '" + USER_HOME_KEY + "'";
        final String str = System.getProperty(USER_HOME_KEY);
        if (str == null) {
            throw new IllegalStateException(errMsg + " not found!");
        }
        final String userHome = str.trim();
        if (userHome.length() == 0) {
            throw new IllegalStateException(errMsg + " is empty!");
        }
        final File dir = new File(userHome);
        try {
            checkValidDir(dir);
        } catch (final IllegalArgumentException ex) {
            throw new IllegalStateException(errMsg + " is not valid! [" + ex.getMessage() + "]");
        }
        return dir;
    }
284007
private static function getHomeDir()
    {
        // On Linux/Unix-like systems, use the HOME environment variable
        if ($homeDir = getenv('HOME')) {
            return $homeDir;
        }

        // Get the HOMEDRIVE and HOMEPATH values for Windows hosts
        if (($homeDrive = getenv('HOMEDRIVE')) && ($homePath = getenv('HOMEPATH'))) {
            return $homeDrive . $homePath;
        }

        throw new BadMethodCallException('Cannot establish the home directory');
    }
869740
public function homeDir()
    {
        if (null !== $this->home) {
            return $this->home;
        }

        return $this->home = $this->detectHomeDirectory();
    }
785661
def file_path(self) -> str:
        
        user_dir = self.__get_user_path()
        file_path = path.abspath(path.join(user_dir, self.FILENAME))
        return file_path
1097173
def working_directory(self):
        
        if self.chroot_directory and not \
                self._working_directory.startswith(self.chroot_directory):
            return self.chroot_directory + self._working_directory
        else:
            return self._working_directory
315817
public static String getSupportFolder() {
		String homedir = System.getProperty("user.home");
		String dirName = "OpenXES";
		if(isRunningWindows()) {
			// any windows flavor
			(new File(homedir + "\\" + dirName)).mkdirs();	// create directories if necessary
			return homedir + "\\" + dirName + "\\";
		} else if(isRunningMacOsX()) {
			// hey, it's a mac!
			(new File(homedir + "/Library/Application Support/" + dirName)).mkdirs();
			return homedir + "/Library/Application Support/" + dirName + "/";
		} else {
			// most likely Linux or any other *NIX
			(new File(homedir + "/." + dirName)).mkdirs();	// create directories if necessary
			return homedir + "/." + dirName + "/";
		}
	}
1328466
def guess_user_home(other_user=nil)
      this_user = other_user || opts[:user]
      @rye_guessed_homes ||= {}
      
      # A simple cache. 
      return @rye_guessed_homes[this_user] if @rye_guessed_homes.has_key?(this_user)
      
      # Some junk to determine where user home directories are by default.
      # We're relying on the command "useradd -D" so this may not work on
      # different Linuxen and definitely won't work on Windows.
      # This code will be abstracted out once I find a decent home for it.
      # /etc/default/useradd, HOME=/home OR useradd -D
      # /etc/adduser.config, DHOME=/home OR ??
      user_defaults = {}
      ostmp = self.ostype
      ostmp &&= ostype.to_s
      
      if ostmp == "sunos"
        #nv.scan(/([\w_-]+?)=(.+?)\s/).each do |n, v|
        #  n = 'HOME' if n == 'basedir'
        #  user_defaults[n.upcase] = v.strip
        #end
        # In Solaris, useradd -D says the default home path is /home
        # but that directory is not writable. See: http://bit.ly/IJDD0
        user_defaults['HOME'] = '/export/home'
      elsif ostmp == "darwin"
        user_defaults['HOME'] = '/Users'
      elsif ostmp == "windows"
        user_defaults['HOME'] = 'C:/Documents and Settings'
      else
        raw = self.quietly { useradd(:D) } rescue []
        raw = ["HOME=/home"] if raw.nil? || raw.empty?
        raw.each do |nv|
          n, v = nv.scan(/\A([\w_-]+?)=(.+)\z/).flatten
          user_defaults[n] = v
        end
      end
      
      @rye_guessed_homes[this_user] = "#{user_defaults['HOME']}/#{this_user}"
    end
512836
public static String getHadoopUser() {
		try {
			Class<?> ugiClass = Class.forName(
				"org.apache.hadoop.security.UserGroupInformation",
				false,
				EnvironmentInformation.class.getClassLoader());

			Method currentUserMethod = ugiClass.getMethod("getCurrentUser");
			Method shortUserNameMethod = ugiClass.getMethod("getShortUserName");
			Object ugi = currentUserMethod.invoke(null);
			return (String) shortUserNameMethod.invoke(ugi);
		}
		catch (ClassNotFoundException e) {
			return "<no hadoop dependency found>";
		}
		catch (LinkageError e) {
			// hadoop classes are not in the classpath
			LOG.debug("Cannot determine user/group information using Hadoop utils. " +
					"Hadoop classes not loaded or compatible", e);
		}
		catch (Throwable t) {
			// some other error occurred that we should log and make known
			LOG.warn("Error while accessing user/group information via Hadoop utils.", t);
		}
		
		return UNKNOWN;
	}
871271
protected String getHadoopClientHome() {
    String h = env_.getProperty("HADOOP_HOME"); // standard Hadoop
    if (h == null) {
      //fail("Missing required environment variable: HADOOP_HOME");
      h = "UNDEF";
    }
    return h;
  }
1014127
def user_homedir(username=None):
    
    if username:
        return os.path.expanduser('~%s/' % username)
    elif 'HOME' in os.environ:
        return os.environ['HOME']
    elif os.name == 'posix':
        return os.path.expanduser('~/')
    else:
        raise RuntimeError('This function has failed at life.')
1213269
def user_config_dir():
    
    """
    if WINDOWS:
        path = os.environ.get('APPDATA')
    elif MACOS:
        path = os.path.expanduser('~/Library/Application Support')
    else:
        path = os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config')
    if path is None:
        path = ''
    else:
        path = os.path.join(path, 'glances')

    return path
154092
public static File home() throws VictimsException {
        File directory = new File(getPropertyValue(Key.HOME));
        if (!directory.exists()) {
            try {
                FileUtils.forceMkdir(directory);
            } catch (IOException e) {
                throw new VictimsException("Could not create home directory.",
                        e);
            }
        }
        return directory;
    }
1322
def get_root_folder():
    
    locations = {
     'linux':{'hme':'/home/duncan/', 'core_folder':'/home/duncan/dev/src/python/AIKIF'},
     'win32':{'hme':'T:\\user\\',    'core_folder':'T:\\user\\dev\\src\\python\\AIKIF'},
     'cygwin':{'hme':os.getcwd() + os.sep,    'core_folder':os.getcwd()},
     'darwin':{'hme':os.getcwd() + os.sep,    'core_folder':os.getcwd()}
    }
    hme = locations[sys.platform]['hme']
    core_folder = locations[sys.platform]['core_folder']

    if not os.path.exists(core_folder):
        hme = os.getcwd()        
        core_folder = os.getcwd()
        print('config.py : running on CI build (or you need to modify the paths in config.py)')
    return hme, core_folder
146935
public static function getUserHomeFolder()
    {
        // Get home folder if available (Unix)
        if (!empty($_SERVER['HOME'])) {
            return $_SERVER['HOME'];
            // Else use the home drive (Windows)
        } elseif (!empty($_SERVER['HOMEDRIVE']) && !empty($_SERVER['HOMEPATH'])) {
            return $_SERVER['HOMEDRIVE'].$_SERVER['HOMEPATH'];
        }

        throw new Exception('Cannot determine user home directory.');
    }
1145097
@Pure
	public static File getUserHomeDirectory() throws FileNotFoundException {
		final String userHome = System.getProperty("user.home"); //$NON-NLS-1$
		if (userHome != null && !userHome.isEmpty()) {
			final File file = new File(userHome);
			if (file.isDirectory()) {
				return file;
			}
		}
		if (OperatingSystem.ANDROID.isCurrentOS()) {
			return join(File.listRoots()[0], Android.HOME_DIRECTORY);
		}
		throw new FileNotFoundException();
	}
142248
def get_default_home_dir():
    
    ding0_dir = str(cfg_ding0.get('config',
                                  'config_dir'))
    return os.path.join(os.path.expanduser('~'), ding0_dir)