Combined path filtering into a single filter to avoid iterating through the list multiple times.

This commit is contained in:
CalDescent 2021-12-04 12:06:15 +00:00
parent 0a2b4dedc7
commit a87fe8b44d

View File

@ -235,9 +235,9 @@ public class ArbitraryDataStorageManager extends Thread {
// Also exclude the _temp and _misc paths if present
List<Path> allPaths = Files.walk(dataPath, 3)
.filter(Files::isDirectory)
.filter(path -> !path.toAbsolutePath().toString().contains(tempPath.toAbsolutePath().toString()))
.filter(path -> !path.toString().contains("_misc"))
.filter(path -> path.getFileName().toString().length() > 32)
.filter(path -> !path.toAbsolutePath().toString().contains(tempPath.toAbsolutePath().toString())
&& !path.toString().contains("_misc")
&& path.getFileName().toString().length() > 32)
.collect(Collectors.toList());
// Loop through each path and attempt to match it to a signature