code: private String getPathUntilWildcard(String locationPatternString, boolean defaultToLocaldir) {
          String currentLocationPatternString;
  
          int locationPatternStringLength = locationPatternString.length();
  
          //Find the first occurrence of * or ?, if none, set idx to locationPatternLength
          int startIndex, questionMarkIndex;
          if ((startIndex = locationPatternString.indexOf('*')) == -1)
              startIndex = locationPatternStringLength;
  
          if ((questionMarkIndex = locationPatternString.indexOf('?')) == -1)
              questionMarkIndex = locationPatternStringLength;
  
          currentLocationPatternString = locationPatternString.substring(0, Math.min(startIndex, questionMarkIndex));
          if (defaultToLocaldir && !(new File(currentLocationPatternString).canRead()))
              currentLocationPatternString = "./";
          return currentLocationPatternString;
      }
docs: Returns a substring of the locationPattern from the beginning
  to the first occurrence of * or ?
  If this is unsuccessful, start at current directory ./
  @param locationPatternString The Ant-Style location pattern.
  @return  A substring of the locationPatternString from the beginning to the first occurrence of a wildcard character