skip broken folder when re-index (#2004)

* skip broken folder when re-index

* add log for DirectoryNotFoundException
This commit is contained in:
Dandjinh
2018-07-15 11:28:01 +08:00
committed by jhdxr
parent c393db9c9f
commit be43c2156f

View File

@@ -216,7 +216,15 @@ namespace Wox.Plugin.Program.Programs
{
foreach (var suffix in suffixes)
{
files.AddRange(Directory.EnumerateFiles(currentDirectory, $"*.{suffix}", SearchOption.TopDirectoryOnly));
try
{
files.AddRange(Directory.EnumerateFiles(currentDirectory, $"*.{suffix}", SearchOption.TopDirectoryOnly));
}
catch (DirectoryNotFoundException e)
{
Log.Exception($"|Program.Win32.ProgramPaths|skip directory(<{currentDirectory}>)", e);
continue;
}
}
}
catch (Exception e) when (e is SecurityException || e is UnauthorizedAccessException)