private Path findSubdirectory(
            final Path embulkHome,
            final Properties embulkPropertiesFromFile,
            final String propertyName,
            final String envName,
            final Path subPath) {
        // 1) If a system config <propertyName> is set from the command line, it is the most prioritized.
        //
        // A path in the command line should be an absolute path, or a relative path from the working directory.
        final Optional<Path> ofCommandLine = normalizePathInCommandLineProperties(propertyName);
        if (ofCommandLine.isPresent()) {
            logger.info("{} is set from command-line: {}", propertyName, ofCommandLine.get().toString());
            return ofCommandLine.get();
        }

        // 2) If a system config <propertyName> is set from "embulk.properties", it is the second prioritized.
        //
        // A path in the "embulk.properties" file should be an absolute path, or a relative path from "embulk_home".
        final Optional<Path> ofEmbulkPropertiesFile =
                normalizePathInEmbulkPropertiesFile(propertyName, embulkPropertiesFromFile, embulkHome);
        if (ofEmbulkPropertiesFile.isPresent()) {
            logger.info("{} is set from embulk.properties: {}", propertyName, ofEmbulkPropertiesFile.get().toString());
            return ofEmbulkPropertiesFile.get();
        }

        // 3) If an environment variable <envName> is set, it is the third prioritized.
        //
        // A path in an environment variable should be an absolute path.
        final Optional<Path> ofEnv = normalizePathInEnv(envName);
        if (ofEnv.isPresent()) {
            logger.info("{} is set from environment variable {}: {}", propertyName, envName, ofEnv.get().toString());
            return ofEnv.get();
        }

        // 4) If none of the above does not match, use the specific sub directory of "embulk_home".
        final Path ofSubPath = embulkHome.resolve(subPath);
        logger.info("{} is set as a sub directory of embulk_home: {}", propertyName, ofSubPath);
        return ofSubPath;
    }
Finds an appropriate "embulk_home" directory based on a rule defined.

<ul>
<li>1) If a system config {@code "embulk_home"} is set from the command line, it is the most prioritized.
<li>2) If an environment variable {@code "EMBULK_HOME"} is set, it is the second prioritized.
<li>3) If neither (1) nor (2) is set, it iterates up over parent directories from "user.dir" for a directory that:
  <ul>
  <li>is named ".embulk",
  <li>has "embulk.properties" just under itself.
  </ul>
  <ul>
  <li>3-1) If "user.dir" (almost equal to the working directory) is under "user.home", it iterates up till "user.home".
  <li>3-2) If "user.dir" is not under "user.home", Embulk iterates until the root directory.
  </ul>
</li>
<li>4) If none of the above does not work, use the traditional predefined directory "~/.embulk".
</ul>
embulk-core/src/main/java/org/embulk/cli/EmbulkSystemPropertiesBuilder.java