Skip to content

Commit ad234b6

Browse files
authored
Merge pull request #210 from taooceros/programPlugnUnauthorizeFix
Fix unauthorize exception lead to the whole directory unable to index.
2 parents 98630d1 + 898bb06 commit ad234b6

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Plugins/Flow.Launcher.Plugin.Program/Logger/ProgramLogger.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ internal static void LogException(string classname, string callingMethodName, st
9898
internal static void LogException(string message, Exception e)
9999
{
100100
//Index 0 is always empty.
101-
var parts = message.Split('|');
101+
var parts = message.Split('|', StringSplitOptions.RemoveEmptyEntries);
102102
if (parts.Length < 4)
103103
{
104104
var logger = LogManager.GetLogger("");
105105
logger.Error(e, $"fail to log exception in program logger, parts length is too small: {parts.Length}, message: {message}");
106106
}
107107

108-
var classname = parts[1];
109-
var callingMethodName = parts[2];
110-
var loadingProgramPath = parts[3];
111-
var interpretationMessage = parts[4];
108+
var classname = parts[0];
109+
var callingMethodName = parts[1];
110+
var loadingProgramPath = parts[2];
111+
var interpretationMessage = parts[3];
112112

113113
LogException(classname, callingMethodName, loadingProgramPath, interpretationMessage, e);
114114
}

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public List<Result> ContextMenus(IPublicAPI api)
131131
? $"/select,\"{FullPath}\""
132132
: Settings.ExplorerArgs;
133133

134-
Main.StartProcess(Process.Start,
134+
Main.StartProcess(Process.Start,
135135
new ProcessStartInfo(
136136
!string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer)
137137
? Main._settings.CustomizedExplorer
@@ -267,10 +267,14 @@ private static IEnumerable<string> ProgramPaths(string directory, string[] suffi
267267
return new string[] { };
268268
try
269269
{
270-
var paths = Directory.EnumerateFiles(directory, "*", SearchOption.AllDirectories)
270+
var paths = Directory.EnumerateFiles(directory, "*", new EnumerationOptions
271+
{
272+
IgnoreInaccessible = true,
273+
RecurseSubdirectories = true
274+
})
271275
.Where(x => suffixes.Contains(Extension(x)));
272-
return paths;
273276

277+
return paths;
274278
}
275279
catch (DirectoryNotFoundException e)
276280
{

Plugins/Flow.Launcher.Plugin.Program/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Name": "Program",
55
"Description": "Search programs in Flow.Launcher",
66
"Author": "qianlifeng",
7-
"Version": "1.1.0",
7+
"Version": "1.1.1",
88
"Language": "csharp",
99
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
1010
"ExecuteFileName": "Flow.Launcher.Plugin.Program.dll",

0 commit comments

Comments
 (0)