优先获取大小写敏感的路径，如若找不到，则获取忽略大小写后的路径

@param tempHome
@param subDirPath
330463
private File searchDirectory(File tempHome, String subDirPath) {
        // 
        String[] subDirs = StringUtils.split(subDirPath, "/");
        for (final String subDir : subDirs) {
            File file = new File(tempHome, subDir);
            if (!file.exists()) {
                String[] candidates = tempHome.list(new FilenameFilter() {

                    @Override
                    public boolean accept(File dir, String name) {
                        if (name.equalsIgnoreCase(subDir)) {
                            return true;
                        }
                        return false;
                    }

                });
                if (candidates.length == 0) {
                    tempHome = null;
                    break;
                } else {
                    tempHome = new File(tempHome, candidates[0]);
                }
            } else {
                tempHome = file;
            }
        }
        return tempHome;
    }
636011
public void subDivide() {
        northWest = new QuadTree(this, data, new Cell(boundary.getX() - .5 * boundary.getHw(),
                        boundary.getY() - .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));
        northEast = new QuadTree(this, data, new Cell(boundary.getX() + .5 * boundary.getHw(),
                        boundary.getY() - .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));
        southWest = new QuadTree(this, data, new Cell(boundary.getX() - .5 * boundary.getHw(),
                        boundary.getY() + .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));
        southEast = new QuadTree(this, data, new Cell(boundary.getX() + .5 * boundary.getHw(),
                        boundary.getY() + .5 * boundary.getHh(), .5 * boundary.getHw(), .5 * boundary.getHh()));

    }
632154
@Override
  public PathImpl schemeWalk(String userPath,
                         Map<String,Object> attributes,
                         String filePath,
                         int offset)
  {
    int length = filePath.length();

    if (length <= offset || filePath.charAt(offset) != '(')
      return super.schemeWalk(userPath, attributes, filePath, offset);

    MergePath mergePath = createMergePath();
    mergePath.setUserPath(userPath);

    int head = ++offset;
    int tail = head;
    while (tail < length) {
      int ch = filePath.charAt(tail);

      if (ch == ')') {
        if (head + 1 != tail) {
          String subPath = filePath.substring(head, tail);

          if (subPath.startsWith("(") && subPath.endsWith(")"))
            subPath = subPath.substring(1, subPath.length() - 1);

          mergePath.addMergePath(VfsOld.lookup(subPath));
        }

        if (tail + 1 == length)
          return mergePath;
        else
          return mergePath.fsWalk(userPath, attributes, filePath.substring(tail + 1));
      }
      else if (ch == ';') {
        String subPath = filePath.substring(head, tail);

        if (subPath.startsWith("(") && subPath.endsWith(")"))
          subPath = subPath.substring(1, subPath.length() - 1);

        mergePath.addMergePath(VfsOld.lookup(subPath));

        head = ++tail;
      }
      else if (ch == '(') {
        int depth = 1;

        for (tail++; tail < length; tail++) {
          if (filePath.charAt(tail) == '(')
            depth++;
          else if (filePath.charAt(tail) == ')') {
            tail++;
            depth--;
            if (depth == 0)
              break;
          }
        }

        if (depth != 0)
          return new NotFoundPath(getSchemeMap(), filePath);
      }
      else
        tail++;
    }

    return new NotFoundPath(getSchemeMap(), filePath);
  }
1042306
private void outputResult() throws DITAOTException {
        try {
            tempFileNameScheme = (TempFileNameScheme) Class.forName(job.getProperty("temp-file-name-scheme")).newInstance();
        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
            throw new RuntimeException(e);
        }
        tempFileNameScheme.setBaseDir(baseInputDir);

        // assume empty Job
        final URI rootTemp = tempFileNameScheme.generateTempFileName(rootFile);
        final File relativeRootFile = toFile(rootTemp);

        job.setInputDir(baseInputDir);
        job.setInputMap(rootTemp);
        
        //If root input file is marked resource only due to conref or other feature, remove that designation
        if (resourceOnlySet.contains(rootFile)) {
            resourceOnlySet.remove(rootFile);
        }

        job.setProperty(INPUT_DITAMAP_LIST_FILE_LIST, USER_INPUT_FILE_LIST_FILE);
        final File inputfile = new File(job.tempDir, USER_INPUT_FILE_LIST_FILE);
        writeListFile(inputfile, relativeRootFile.toString());

        job.setProperty("tempdirToinputmapdir.relative.value", StringUtils.escapeRegExp(getPrefix(relativeRootFile)));
        job.setProperty("uplevels", getLevelsPath(rootTemp));

        resourceOnlySet.addAll(listFilter.getResourceOnlySet());

        if (job.getOnlyTopicInMap() || !job.crawlTopics()) {
            resourceOnlySet.addAll(listFilter.getNonTopicrefReferenceSet());
        }

        for (final URI file: outDitaFilesSet) {
            getOrCreateFileInfo(fileinfos, file).isOutDita = true;
        }
        for (final URI file: fullTopicSet) {
            final FileInfo ff = getOrCreateFileInfo(fileinfos, file);
            if (ff.format == null) {
                ff.format = sourceFormat.getOrDefault(ff.src, ATTR_FORMAT_VALUE_DITA);
            }
        }
        for (final URI file: fullMapSet) {
            final FileInfo ff = getOrCreateFileInfo(fileinfos, file);
            if (ff.format == null) {
                ff.format = ATTR_FORMAT_VALUE_DITAMAP;
            }
        }
        for (final URI file: hrefTopicSet) {
            final FileInfo f = getOrCreateFileInfo(fileinfos, file);
            f.hasLink = true;
            if (f.format == null && sourceFormat.containsKey(f.src)) {
                f.format = sourceFormat.get(f.src);
            }
        }
        for (final URI file: conrefSet) {
            getOrCreateFileInfo(fileinfos, file).hasConref = true;
        }
        for (final Reference file: formatSet) {
            getOrCreateFileInfo(fileinfos, file.filename).format = file.format;
        }
        for (final URI file: flagImageSet) {
            final FileInfo f = getOrCreateFileInfo(fileinfos, file);
            f.isFlagImage = true;
            f.format = ATTR_FORMAT_VALUE_IMAGE;
        }
        for (final String format: htmlSet.keySet()) {
            for (final URI file : htmlSet.get(format)) {
                getOrCreateFileInfo(fileinfos, file).format = format;
            }
        }
        for (final URI file: hrefTargetSet) {
            final FileInfo f = getOrCreateFileInfo(fileinfos, file);
            f.isTarget = true;
            if (f.format == null && sourceFormat.containsKey(f.src)) {
                f.format = sourceFormat.get(f.src);
            }
        }
        for (final URI file: schemeSet) {
            getOrCreateFileInfo(fileinfos, file).isSubjectScheme = true;
        }
        for (final URI file: coderefTargetSet) {
            final FileInfo f = getOrCreateFileInfo(fileinfos, file);
            f.isSubtarget = true;
            if (f.format == null) {
                f.format = PR_D_CODEREF.localName;
            }
        }
        for (final URI file: conrefpushSet) {
            getOrCreateFileInfo(fileinfos, file).isConrefPush = true;
        }
        for (final URI file: keyrefSet) {
            getOrCreateFileInfo(fileinfos, file).hasKeyref = true;
        }
        for (final URI file: coderefSet) {
            getOrCreateFileInfo(fileinfos, file).hasCoderef = true;
        }
        for (final URI file: resourceOnlySet) {
            getOrCreateFileInfo(fileinfos, file).isResourceOnly = true;
        }

        addFlagImagesSetToProperties(job, relFlagImagesSet);

        final Map<URI, URI> filteredCopyTo = filterConflictingCopyTo(copyTo, fileinfos.values());

        for (final FileInfo fs: fileinfos.values()) {
            if (!failureList.contains(fs.src)) {
                final URI src = filteredCopyTo.get(fs.src);
                // correct copy-to
                if (src != null) {
                    final FileInfo corr = new FileInfo.Builder(fs).src(src).build();
                    job.add(corr);
                } else {
                    job.add(fs);
                }
            }
        }
        for (final URI target : filteredCopyTo.keySet()) {
            final URI tmp = tempFileNameScheme.generateTempFileName(target);
            final FileInfo fi = new FileInfo.Builder().result(target).uri(tmp).build();
            job.add(fi);
        }

        final FileInfo root = job.getFileInfo(rootFile);
        if (root == null) {
            throw new RuntimeException("Unable to set input file to job configuration");
        }
        job.add(new FileInfo.Builder(root)
                .isInput(true)
                .build());

        try {
            logger.info("Serializing job specification");
            if (!job.tempDir.exists() && !job.tempDir.mkdirs()) {
                throw new DITAOTException("Failed to create " + job.tempDir + " directory");
            }
            job.write();
        } catch (final IOException e) {
            throw new DITAOTException("Failed to serialize job configuration files: " + e.getMessage(), e);
        }

        try {
            SubjectSchemeReader.writeMapToXML(addMapFilePrefix(listFilter.getRelationshipGrap()), new File(job.tempDir, FILE_NAME_SUBJECT_RELATION));
            SubjectSchemeReader.writeMapToXML(addMapFilePrefix(schemeDictionary), new File(job.tempDir, FILE_NAME_SUBJECT_DICTIONARY));
        } catch (final IOException e) {
            throw new DITAOTException("Failed to serialize subject scheme files: " + e.getMessage(), e);
        }

        if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) {
            final DelayConrefUtils delayConrefUtils = new DelayConrefUtils();
            delayConrefUtils.setLogger(logger);
            delayConrefUtils.setJob(job);
            delayConrefUtils.writeMapToXML(exportAnchorsFilter.getPluginMap());
            delayConrefUtils.writeExportAnchors(exportAnchorsFilter, tempFileNameScheme);
        }

        KeyDef.writeKeydef(new File(job.tempDir, SUBJECT_SCHEME_KEYDEF_LIST_FILE), addFilePrefix(schemekeydefMap.values()));
    }
182887
public static String computeFileRelativeLocation( File rootDirectory, File subFile ) {

		String rootPath = rootDirectory.getAbsolutePath();
		String subPath = subFile.getAbsolutePath();
		if(  ! subPath.startsWith( rootPath ))
			throw new IllegalArgumentException( "The sub-file must be contained in the directory." );

		if(  rootDirectory.equals( subFile ))
			throw new IllegalArgumentException( "The sub-file must be different than the directory." );

		return subPath.substring( rootPath.length() + 1 ).replace( '\\', '/' );
	}
1014135
private void condenseTree(IndexTreePath<E> subtree, Stack<N> stack) {
    N node = getNode(subtree.getEntry());
    // node is not root
    if(!isRoot(node)) {
      N parent = getNode(subtree.getParentPath().getEntry());
      int index = subtree.getIndex();
      if(hasUnderflow(node)) {
        if(parent.deleteEntry(index)) {
          stack.push(node);
        }
        else {
          node.adjustEntry(parent.getEntry(index));
        }
      }
      else {
        node.adjustEntry(parent.getEntry(index));
      }
      writeNode(parent);
      // get subtree to parent
      condenseTree(subtree.getParentPath(), stack);
    }

    // node is root
    else {
      if(hasUnderflow(node) && node.getNumEntries() == 1 && !node.isLeaf()) {
        N child = getNode(node.getEntry(0));
        final N newRoot;
        if(child.isLeaf()) {
          newRoot = createNewLeafNode();
          newRoot.setPageID(getRootID());
          for(int i = 0; i < child.getNumEntries(); i++) {
            newRoot.addLeafEntry(child.getEntry(i));
          }
        }
        else {
          newRoot = createNewDirectoryNode();
          newRoot.setPageID(getRootID());
          for(int i = 0; i < child.getNumEntries(); i++) {
            newRoot.addDirectoryEntry(child.getEntry(i));
          }
        }
        writeNode(newRoot);
        height--;
      }
    }
  }
73780
function (subpath) {
    var pathAsArray = asArrayPath(subpath);
    var absolutePath = Util.joinPaths(this._path, pathAsArray);
    if (absolutePath.length > 0) {
      var absolutePathAsString = asStringPath(absolutePath);
      var cached = this._sharedInternals.cache[absolutePathAsString];

      if (cached) {
        return cached;
      } else {
        var subBinding = new Binding(absolutePath, this._sharedInternals);
        this._sharedInternals.cache[absolutePathAsString] = subBinding;
        return subBinding;
      }
    } else {
      return this;
    }
  }
140825
public void copyLatexSrcToTempDir( File texDirectory, File tempDirectory )
        throws MojoExecutionException
    {
        try
        {
            if ( tempDirectory.exists() )
            {
                log.info( "Deleting existing directory " + tempDirectory.getPath() );
                FileUtils.deleteDirectory( tempDirectory );
            }

            log.debug( "Copying TeX source directory (" + texDirectory.getPath() + ") to temporary directory ("
                + tempDirectory + ")" );
            FileUtils.copyDirectory( texDirectory, tempDirectory );
        }
        catch ( IOException e )
        {
            throw new MojoExecutionException( "Failure copying the TeX directory (" + texDirectory.getPath()
                + ") to a temporary directory (" + tempDirectory.getPath() + ").", e );
        }
    }
133071
private boolean doesModulePathIncludeSubstring(ModuleNode moduleNode, final String substring) {

        if (moduleNode == null) {
            return false;
        }

        boolean substringFoundInDescription = false;
        String commandObjectModuleDescription = moduleNode.getDescription();
        if (commandObjectModuleDescription != null) {
            substringFoundInDescription = commandObjectModuleDescription.contains(substring);
        }
        return substringFoundInDescription;
    }
1209176
public static Action deleteFile(final String path, final String tempDir) {
        if (path == null)
            throw new IllegalArgumentException("The path variable cannot be null");
        if (tempDir == null)
            throw new IllegalArgumentException("The tempDir variable cannot be null");

        final File tempFile = new File(tempDir, Misc.CreateUUID());
        final AtomicBoolean exists = new AtomicBoolean();
        return new Action(
            // Perform:
            new ActionBlock() {
                @Override
                public void execute() throws ActionException {
                    File file = new File(path);
                    if (file.exists()) {
                        if (tempFile == null)
                            throw new ActionException("Cannot perform file deletion as " +
                                    "the temporary file cannot be crated.");

                        boolean success = new File(path).renameTo(tempFile);
                        exists.set(success);
                        if (success)
                            // Mark delete on exit (optional and work on Java only):
                            tempFile.deleteOnExit();
                        else
                            throw new ActionException("Cannot move file " + path +
                                    " to " + tempFile.getAbsolutePath());
                    }
                }
            },
            // Backout:
            new ActionBlock() {
                @Override
                public void execute() throws ActionException {
                    if (exists.get()) {
                        if (!tempFile.renameTo(new File(path)))
                            throw new ActionException("Cannot move file " +
                                    tempFile.getAbsolutePath() + " to " + path);
                    }
                }
            },
            // Cleanup:
            new ActionBlock() {
                @Override
                public void execute() throws ActionException {
                    if (exists.get()) {
                        if (tempFile.isDirectory()) {
                            if (!FileDirUtils.deleteRecursive(tempFile))
                                throw new ActionException("Cannot delete the temporary directory " +
                                        tempFile.getAbsolutePath());
                        } else {
                            if (!tempFile.delete())
                                throw new ActionException("Cannot delete the temporary file " +
                                        tempFile.getAbsolutePath());
                        }
                    }
                }
            });
    }
1223340
def is_subdirectory(path_a, path_b):
    """"""
    path_a = os.path.realpath(path_a)
    path_b = os.path.realpath(path_b)
    relative = os.path.relpath(path_a, path_b)
    return (not relative.startswith(os.pardir + os.sep))
78311
private boolean subModuleExists(File dir) {
        if (isSlotDirectory(dir)) {
            return true;
        } else {
            File[] children = dir.listFiles(File::isDirectory);
            for (File child : children) {
                if (subModuleExists(child)) {
                    return true;
                }
            }
        }

        return false;
    }
1324246
private void addSubDirectory(Path root, Path filePath) throws IOException {
        String listener = getListenerRootPath(root);

        List<String> listeners = mSubDirectories.get(listener);

        if (listeners != null) {
            if (mSubDirectories.get(listener).contains(filePath.toAbsolutePath())) {
                return;
            } else {
                mSubDirectories.get(listener).add(filePath.toString());
            }

            try {
                watchDir(filePath.toFile());
            } catch (IOException e) {
                throw new IOException("Could not watch the subdirectories.", e);
            }
        }
    }
742389
public static void consumeSubFilePaths(Path startDirectoryPath,
			Predicate<Path> filter, Consumer<Path> consumer) {
		consumeSubFilePaths(startDirectoryPath, Integer.MAX_VALUE, filter,
				consumer);
	}
1343678
public static List<Path> getSubDirectoryPathList(Path startDirectoryPath,
			int maxDepth) {
		return getSubPathList(startDirectoryPath, maxDepth,
				DirectoryAndNotSymbolicLinkFilter);
	}
1118974
private boolean isInSubsite(List<String> subSitePaths, String path) {

        boolean result = false;
        for (String subSite : subSitePaths) {
            if (path.startsWith(subSite)) {
                result = true;
                break;
            }
        }
        return result;
    }
401880
public static String valueSubstitution(final String value) {
        final String tmpProp = "java.io.tmpdir";
        final String tmpVar = "{tmp}";
        final String tmpRE = "{tmp}";

        final String homeProp = "user.home";
        final String homeVar = "{home}";
        final String homeRE = "{home}";

        final String nameProp = "user.name";
        final String nameVar = "{name}";
        final String nameRE = "{name}";

        final String cwdProp = "user.dir";
        final String cwdVar = "{dir}";
        final String cwdRE = "{dir}";

        final String bfHomeEnv = PathConstants.BELFRAMEWORK_HOME_ENV_VAR;
        final String bfHomeVar = "{belframework_home}";
        final String bfHomeRE = "{belframework_home}";

        String ret = value;

        if (value.contains(tmpVar)) {
            ret = ret.replace(tmpRE, getProperty(tmpProp));
        }
        if (value.contains(homeVar)) {
            ret = ret.replace(homeRE, getProperty(homeProp));
        }
        if (value.contains(nameVar)) {
            ret = ret.replace(nameRE, getProperty(nameProp));
        }
        if (value.contains(cwdVar)) {
            ret = ret.replace(cwdRE, getProperty(cwdProp));
        }
        if (value.contains(bfHomeVar)) {
            String bfHome = getenv(bfHomeEnv);
            if (bfHome == null) {
                bfHome = ""; //belframework home is not set. Use empty string.
            }
            ret = ret.replace(bfHomeRE, bfHome);
        }
        return ret;
    }