From 27313cdddc7aafcfaeb70ee1f284e41f5df6083e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=98=E9=9F=AC=20=E5=BC=A0?= Date: Tue, 17 Nov 2020 20:41:11 +0800 Subject: [PATCH] Fix unauthorize exception lead to the whole directory unable to index. --- Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index 092418b6c..77278330a 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -131,7 +131,7 @@ namespace Flow.Launcher.Plugin.Program.Programs ? $"/select,\"{FullPath}\"" : Settings.ExplorerArgs; - Main.StartProcess(Process.Start, + Main.StartProcess(Process.Start, new ProcessStartInfo( !string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer) ? Main._settings.CustomizedExplorer @@ -267,10 +267,14 @@ namespace Flow.Launcher.Plugin.Program.Programs return new string[] { }; try { - var paths = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories) + var paths = Directory.EnumerateFiles(directory, "*", new EnumerationOptions + { + IgnoreInaccessible = true, + RecurseSubdirectories = true + }) .Where(x => suffixes.Contains(Extension(x))); - return paths; + return paths; } catch (DirectoryNotFoundException e) {