Skip to content

Commit f64ebdc

Browse files
committed
simplify get path method
1 parent fac2428 commit f64ebdc

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Flow.Launcher.Core.Resource;
1+
using Flow.Launcher.Core.Resource;
22
using Flow.Launcher.Infrastructure;
33
using Flow.Launcher.Plugin.SharedCommands;
44
using System;
@@ -21,23 +21,22 @@ public static void Init(PluginInitContext context, Settings settings)
2121
Settings = settings;
2222
}
2323

24-
private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
24+
public static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword)
2525
{
26-
string keyword;
27-
// Using Quick Access or Index Search action keywords to then navigate to directory
28-
if (actionKeyword == Settings.PathSearchActionKeyword || actionKeyword == Settings.SearchActionKeyword)
29-
{
30-
keyword = actionKeyword == Settings.PathSearchActionKeyword ? $"{actionKeyword} " : string.Empty;
31-
}
32-
else
33-
{
34-
keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled
35-
? $"{Settings.PathSearchActionKeyword} "
36-
: Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
37-
? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used
38-
: $"{Settings.SearchActionKeyword} ";
39-
}
26+
// actionKeyword will be empty string if using global, query.ActionKeyword is ""
4027

28+
var usePathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled;
29+
30+
var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign
31+
? string.Empty
32+
: $"{Settings.PathSearchActionKeyword} ";
33+
34+
var searchActionKeyword = Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign
35+
? string.Empty
36+
: $"{Settings.SearchActionKeyword} ";
37+
38+
var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword;
39+
4140
var formatted_path = path;
4241

4342
if (type == ResultType.Folder)

0 commit comments

Comments
 (0)