Simplify logic

This commit is contained in:
VictoriousRaptor 2025-12-30 00:41:25 +08:00
parent 1ca5951d16
commit 4cbd7f32c6

View file

@ -112,15 +112,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search.WindowsIndex
return null;
var typesList = allowedResultTypes as IList<ResultType> ?? allowedResultTypes.ToList();
// No filtering needed if empty or all types are allowed
// TODO: what if more types are added in the future?
if (typesList.Count == 0 || typesList.Count == 3)
return null;
var hasFile = typesList.Contains(ResultType.File);
var hasFolder = typesList.Contains(ResultType.Folder) || typesList.Contains(ResultType.Volume); // Folder and volume are merged in Folder action keyword so treat them as same
// No filtering needed if empty or all types are allowed
if (hasFile && hasFolder || !hasFile && !hasFolder)
return null;
if (hasFolder)
return "System.ItemType = '.directory'";