public Matching getMatching()

in command.line/java/com/jetbrains/teamcity/resources/FileBasedMatcher.java [104:123]


  public Matching getMatching(final File file) throws IllegalArgumentException {
    try {
      final String filePath = Util.toPortableString(file.getCanonicalFile().getAbsolutePath());
      for (final String rulePath : myRulesMap.keySet()) {
        if (filePath.startsWith(rulePath)) {

          String relativePath = FileUtil.getRelativePath(rulePath, filePath, '/');
          if (".".equals(relativePath)) relativePath = "";
          if (relativePath == null || relativePath.startsWith("..")) continue;
          
          return new MatchingImpl(myRulesMap.get(rulePath), relativePath);
        }
      }
      return null;

    } catch (IOException e) {
      throw new IllegalArgumentException(e);

    }
  }