diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml index 60a15ca33..bf9535820 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml @@ -64,6 +64,8 @@ Directory Recursive Search Engine Index Search Engine Open Windows Index Option + Ignored File Types (comma seperated) + For example: exe,jpg,png Explorer diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs index f53623ac0..41a98b929 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/SearchManager.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Flow.Launcher.Plugin.Explorer.Exceptions; +using Path = System.IO.Path; namespace Flow.Launcher.Plugin.Explorer.Search { @@ -109,7 +110,11 @@ namespace Flow.Launcher.Plugin.Explorer.Search try { await foreach (var search in searchResults.WithCancellation(token).ConfigureAwait(false)) - results.Add(ResultManager.CreateResult(query, search)); + if (search.Type == ResultType.File && IsExcludedFile(search)) { + continue; + } else { + results.Add(ResultManager.CreateResult(query, search)); + } } catch (OperationCanceledException) { @@ -247,5 +252,13 @@ namespace Flow.Launcher.Plugin.Explorer.Search x => FilesFolders.ReturnPreviousDirectoryIfIncompleteString(pathToDirectory).StartsWith(x.Path, StringComparison.OrdinalIgnoreCase)) && WindowsIndex.WindowsIndex.PathIsIndexed(pathToDirectory); } + + private bool IsExcludedFile(SearchResult result) + { + string[] excludedFileTypes = Settings.ExcludedFileTypes.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + string fileExtension = Path.GetExtension(result.FullPath).TrimStart('.'); + + return excludedFileTypes.Contains(fileExtension); + } } }