得到USER_HOME目录

@param base 用户目录下文件夹
@return 得到用户目录
421677
public static String getUserHomeDir(String base) {
        String userhome = System.getProperty("user.home");
        File file = new File(userhome, base);
        if (file.exists()) {
            if (!file.isDirectory()) {
                // LOGGER.error("{} exists, but not directory", file.getAbsolutePath());
                throw new SofaRpcRuntimeException(file.getAbsolutePath() + " exists, but not directory");
            }
        } else {
            file.mkdirs(); // 可能创建不成功
        }
        return file.getAbsolutePath();
    }
516561
public static void resetBaseDirectoryLocation(){
        String property = System.getProperty(DL4JSystemProperties.DL4J_RESOURCES_DIR_PROPERTY);
        if(property != null){
            baseDirectory = new File(property);
        } else {
            baseDirectory = new File(System.getProperty("user.home"), ".deeplearning4j");
        }

        if(!baseDirectory.exists()){
            baseDirectory.mkdirs();
        }
    }
96766
function(includePath, defaultBase)
        {
            includePath = includePath || "";
            var rewriter = getRewriter(includePath);
            return function(path, base)
            {
                // base should always be a dirname with no trailing slash
                var obj = normalizeHash(path, rewriter);
                path = obj.path;
                var first2Chars = path.substr(0, 2);
                if(
                    first2Chars !== ".." && first2Chars !== "./" && first2Chars !== "//" && first2Chars[0] !== "/" && path.indexOf("://") === -1
                ) {
                    path = includePath + "/" + path;
                }
                return url(path, (base || defaultBase)) + obj.hash;
            }
        }
802996
private File resolveBasedir() throws IOException {
    String path = null;

    if (project != null) {
      File file = project.getBasedir();
      if (file != null) {
        path = file.getAbsolutePath();
      }
    }

    if (path == null) {
      path = session.getExecutionRootDirectory();
    }

    if (path == null) {
      path = System.getProperty("user.dir");
    }

    return new File(path).getCanonicalFile();
  }
699674
@VisibleForTesting
    URI getBaseDir() {
        URI baseDir = job.getInputDir();

        final Collection<FileInfo> fis = job.getFileInfo();
        for (final FileInfo fi : fis) {
            final URI res = fi.result.resolve(".");
            baseDir = Optional.ofNullable(getCommonBase(baseDir, res)).orElse(baseDir);
        }

        return baseDir;
    }
325860
def _conan_user_home(self, conan, in_workdir=False):
    
    # This argument is exposed so tests don't leak out of the workdir.
    if in_workdir:
      base_cache_dir = self.workdir
    else:
      base_cache_dir = get_pants_cachedir()
    user_home_base = os.path.join(base_cache_dir, 'conan-support', 'conan-user-home')
    # Locate the subdirectory of the pants shared cachedir specific to this task's option values.
    user_home = os.path.join(user_home_base, self.fingerprint)
    conan_install_base = os.path.join(user_home, '.conan')
    # Conan doesn't copy remotes.txt into the .conan subdir after the "config install" command, it
    # simply edits registry.json. However, it is valid to have this file there, and Conan won't
    # touch it, so we use its presence to detect whether we have appropriately initialized the
    # Conan installation.
    remotes_txt_sentinel = os.path.join(conan_install_base, 'remotes.txt')
    if not os.path.isfile(remotes_txt_sentinel):
      safe_mkdir(conan_install_base)
      # Conan doesn't consume the remotes.txt file just by being in the conan directory -- we need
      # to create another directory containing any selection of files detailed in
      # https://docs.conan.io/en/latest/reference/commands/consumer/config.html#conan-config-install
      # and "install" from there to our desired conan directory.
      with temporary_dir() as remotes_install_dir:
        # Create an artificial conan configuration dir containing just remotes.txt.
        remotes_txt_for_install = os.path.join(remotes_install_dir, 'remotes.txt')
        safe_file_dump(remotes_txt_for_install, self._remotes_txt_content)
        # Configure the desired user home from this artificial config dir.
        argv = ['config', 'install', remotes_install_dir]
        workunit_factory = functools.partial(
          self.context.new_workunit,
          name='initial-conan-config',
          labels=[WorkUnitLabel.TOOL])
        env = {
          'CONAN_USER_HOME': user_home,
        }
        cmdline, exit_code = conan.run(workunit_factory, argv, env=env)
        if exit_code != 0:
          raise self.ConanConfigError(
            'Error configuring conan with argv {} and environment {}: exited non-zero ({}).'
            .format(cmdline, env, exit_code),
            exit_code=exit_code)
      # Generate the sentinel file so that we know the remotes have been successfully configured for
      # this particular task fingerprint in successive pants runs.
      safe_file_dump(remotes_txt_sentinel, self._remotes_txt_content)

    return user_home
425297
public static String getUserApplicationConfigurationFilePath(
		@NonNull final String applicationName, @NonNull final String configFileName)
	{
		return System.getProperty(USER_HOME_PROPERTY_KEY) + File.separator + applicationName
			+ File.separator + configFileName;
	}
826617
function getHomePath () {
  if (process.platform === 'win32') {
    return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || process.env.HOME
  } else {
    return process.env.HOME
  }
}
765497
@Override
  public Path getHomeDirectory() {
    Path result = new Path(getFileSystemRoot(), getHomeDirectorySubpath());
    logger.atFine().log("GHFS.getHomeDirectory:=> %s", result);
    return result;
  }
1295301
private static Properties overrideDockerPropertiesWithSettingsFromUserHome(Properties p, Properties systemProperties) {
        Properties overriddenProperties = new Properties();
        overriddenProperties.putAll(p);

        final File usersDockerPropertiesFile = new File(systemProperties.getProperty("user.home"),
                "." + DOCKER_JAVA_PROPERTIES);
        if (usersDockerPropertiesFile.isFile()) {
            try (FileInputStream in = new FileInputStream(usersDockerPropertiesFile)) {
                overriddenProperties.load(in);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return overriddenProperties;
    }
447620
function searchBase(base) {
    var basename = path.resolve(base, modulename);

    // return no path
    var filename = searchArray(dirMap, basename);
    if (filename) return filename;

    // return .js path
    filename = searchArray(dirMap, basename + '.js');
    if (filename) return filename;

    // return .json path
    filename = searchArray(dirMap, basename + '.json');
    if (filename) return filename;

    // if input was an path, do search more
    if (isPath) return false;

    // resolve and return /package.json path
    if (packageMap[basename]) {
      return packageMap[basename];
    }

    return searchArray(dirMap, basename + '/index.js');
  }
779878
private static String initializeBaseDir() {
        LOGGER.entering();
        String repoFolderName = System.getProperty(ARTIFACT_BASE_CONFIG_PROPERTY,
                ConfigParser.parse().getString(ARTIFACT_BASE_CONFIG_PROPERTY, "repository"));
        repoFolderName = StringUtils.defaultIfEmpty(repoFolderName, "repository");
        LOGGER.exiting(repoFolderName);
        return repoFolderName;
    }
445193
private File getFedoraHomeDir() throws ServletException {

        String fedoraHome = Constants.FEDORA_HOME;
        if (fedoraHome == null) {
            failStartup("FEDORA_HOME was not configured properly.  It must be "
                    + "set via the fedora.home servlet init-param (preferred), "
                    + "the fedora.home system property, or the FEDORA_HOME "
                    + "environment variable.", null);
        }
        File fedoraHomeDir = new File(fedoraHome);
        if (!fedoraHomeDir.isDirectory()) {
            failStartup("The FEDORA_HOME directory, " + fedoraHomeDir.getPath()
                    + " does not exist", null);
        }
        File writeTest = new File(fedoraHomeDir, "writeTest.tmp");
        String writeErrorMessage =
                "The FEDORA_HOME directory, " + fedoraHomeDir.getPath()
                        + " is not writable by " + "the current user, "
                        + System.getProperty("user.name");
        try {
            writeTest.createNewFile();
            if (!writeTest.exists()) {
                throw new IOException("");
            }
            writeTest.delete();
        } catch (IOException e) {
            failStartup(writeErrorMessage, null);
        }

        return fedoraHomeDir;
    }
751582
protected static String getHomeDir(String[] args) {
        if (System.getenv(HOME_DIR) == null) {
            if (args.length > index) {
                return args[index++];
            } else {
                return ".";
            }
        } else {
            return System.getenv(HOME_DIR);
        }
    }
217845
def expanduser(self):
        
        if (not (self._drv or self._root)
                and self._parts and self._parts[0][:1] == '~'):
            homedir = self._flavour.gethomedir(self._parts[0][1:])
            return self._from_parts([homedir] + self._parts[1:])

        return self
886158
public static File getBaseDir(final List<File> files) {
        String common = getCommonPrefix(files.stream().map(new Function<File, String>() {
            @Override
            public String apply(final File file) {
                return file.getAbsolutePath();
            }
        }).collect(Collectors.toList()));
        if (null != common) {
            return new File(common);
        }
        return null;
    }
964654
def _get_userdir(user=None):
    """"""

    if user is not None and not isinstance(user, fsnative):
        raise TypeError

    if is_win:
        if "HOME" in environ:
            path = environ["HOME"]
        elif "USERPROFILE" in environ:
            path = environ["USERPROFILE"]
        elif "HOMEPATH" in environ and "HOMEDRIVE" in environ:
            path = os.path.join(environ["HOMEDRIVE"], environ["HOMEPATH"])
        else:
            return

        if user is None:
            return path
        else:
            return os.path.join(os.path.dirname(path), user)
    else:
        import pwd

        if user is None:
            if "HOME" in environ:
                return environ["HOME"]
            else:
                try:
                    return path2fsn(pwd.getpwuid(os.getuid()).pw_dir)
                except KeyError:
                    return
        else:
            try:
                return path2fsn(pwd.getpwnam(user).pw_dir)
            except KeyError:
                return