@NotNull public static List<String> completeAbsolutePath(@NotNull String prefix,Predicate<File> accept){
  String nativePath=prefix.startsWith("/") && SystemInfoRt.isWindows ? OSUtil.bashCompatibleToNative(prefix) : prefix;
  File base=new File(nativePath);
  boolean dotSuffix=prefix.endsWith(".") && !prefix.startsWith(".");
  if (!base.exists() || dotSuffix) {
    base=base.getParentFile();
    if (base == null || !base.exists()) {
      return Collections.emptyList();
    }
  }
  File basePath;
  String matchPrefix;
  if (base.isDirectory()) {
    basePath=base;
    matchPrefix="";
  }
 else {
    basePath=base.getParentFile();
    matchPrefix=base.getName();
  }
  List<String> result=Lists.newLinkedList();
  for (  File fileCandidate : collectFiles(basePath,matchPrefix)) {
    if (!accept.apply(fileCandidate)) {
      continue;
    }
    String resultPath;
    if (fileCandidate.isDirectory()) {
      resultPath=fileCandidate.getAbsolutePath() + File.separator;
    }
 else {
      resultPath=fileCandidate.getAbsolutePath();
    }
    result.add(OSUtil.toBashCompatible(resultPath));
  }
  return result;
}

@ NotNull public static List < String > completeAbsolutePath ( @ NotNull String prefix , Predicate < File > accept ) { String nativePath = prefix . startsWith ( "/" ) && SystemInfoRt . isWindows ? OSUtil . bashCompatibleToNative ( prefix ) : prefix ; File base = new File ( nativePath ) ; boolean dotSuffix = prefix . endsWith ( "." ) && ! prefix . startsWith ( "." ) ; if ( ! base . exists ( ) || dotSuffix ) { base = base . getParentFile ( ) ; if ( base == null || ! base . exists ( ) ) { return Collections . emptyList ( ) ; } } File basePath ; String matchPrefix ; if ( base . isDirectory ( ) ) { basePath = base ; matchPrefix = "" ; } else { basePath = base . getParentFile ( ) ; matchPrefix = base . getName ( ) ; } List < String > result = Lists . newLinkedList ( ) ; for ( File fileCandidate : collectFiles ( basePath , matchPrefix ) ) { if ( ! accept . apply ( fileCandidate ) ) { continue ; } String resultPath ; if ( fileCandidate . isDirectory ( ) ) { resultPath = fileCandidate . getAbsolutePath ( ) + File . separator ; } else { resultPath = fileCandidate . getAbsolutePath ( ) ; } result . add ( OSUtil . toBashCompatible ( resultPath ) ) ; } return result ; }
provide a list of absolute paths on the current system which match the given prefix . prefix is path whose last entry may be a partial match . a match with " / etc / def " matches all files and directories in / etc which start with " def " .
