Filter script download suggestions according to player input (#958)

This commit is contained in:
altrisi authored and GitHub committed 2021-06-27 22:33:13 -03:00
1 parent b1b7956ea9
commit cd50919a90
1 file changed
+7 -2
@@ -215,10 +215,15 @@ public class AppStoreManager
StoreNode appKiosk = appStoreRoot;
for(String pathElement : path)
{
if (appKiosk.cannotContinueFor(pathElement)) return appKiosk.createPathSuggestions();
if (appKiosk.cannotContinueFor(pathElement)) break;
appKiosk = appKiosk.children.get(pathElement);
}
return appKiosk.createPathSuggestions();
List<String> filteredSuggestions = appKiosk.createPathSuggestions().stream().filter(s -> s.startsWith(currentPath)).collect(Collectors.toList());
if (filteredSuggestions.size() == 1) {
if (!appKiosk.isLeaf())
return suggestionsFromPath(filteredSuggestions.get(0)); // Start suggesting directory contents
}
return filteredSuggestions;
}