mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add more error handling, fix #1252
This commit is contained in:
parent
b7ecbd3b51
commit
886e35477e
1 changed files with 24 additions and 4 deletions
|
|
@ -5,6 +5,7 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using Microsoft.Win32;
|
||||
using Shell;
|
||||
|
|
@ -205,9 +206,17 @@ namespace Wox.Plugin.Program.Programs
|
|||
{
|
||||
if (Directory.Exists(directory))
|
||||
{
|
||||
var files = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories).Where(
|
||||
f => suffixes.Contains(Extension(f))
|
||||
);
|
||||
IEnumerable<string> files;
|
||||
try
|
||||
{
|
||||
files = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories);
|
||||
}
|
||||
catch (Exception e) when (e is SecurityException || e is UnauthorizedAccessException)
|
||||
{
|
||||
Log.Exception($"|Program.Win32.ProgramPaths|Can't parse directory <{directory}>", e);
|
||||
return new string[] { };
|
||||
}
|
||||
files = files.Where(f => suffixes.Contains(Extension(f)));
|
||||
return files;
|
||||
}
|
||||
else
|
||||
|
|
@ -308,10 +317,21 @@ namespace Wox.Plugin.Program.Programs
|
|||
entry.ExecutableName = subkey;
|
||||
return entry;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Win32();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Win32();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Win32();
|
||||
}
|
||||
}
|
||||
return new Win32();
|
||||
}
|
||||
|
||||
//private static Win32 ScoreFilter(Win32 p)
|
||||
|
|
|
|||
Loading…
Reference in a new issue