public class FileFinder extends Object
Modifier and Type | Method and Description |
---|---|
static com.google.common.collect.ImmutableSet<String> |
combine(Set<String> prefixes,
String base,
Set<String> suffixes)
Combines prefixes, base, and suffixes to create a set of file names.
|
static Optional<Path> |
getOptionalFile(Set<String> possibleNames,
Iterable<Path> searchPaths,
java.util.function.Predicate<Path> filter)
Tries to find a file with one of a number of possible names in a search path.
|
public static com.google.common.collect.ImmutableSet<String> combine(Set<String> prefixes, String base, Set<String> suffixes)
prefixes
- set of prefixes. May be empty.base
- base name. May be empty.suffixes
- set of suffixes. May be empty.public static Optional<Path> getOptionalFile(Set<String> possibleNames, Iterable<Path> searchPaths, java.util.function.Predicate<Path> filter)
Returns the first match found. Search tries all paths in the search paths in order, looking for any matching names in each path.
possibleNames
- file names to look for.searchPaths
- directories to search.filter
- additional check that discovered paths must pass to be eligible.