From f64ebdca957013f0950b3ac61b1b5e95dd7dad68 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Sat, 24 Dec 2022 22:51:09 +1100 Subject: [PATCH] simplify get path method --- .../Search/ResultManager.cs | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs index 69df2764d..1d3a57996 100644 --- a/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs +++ b/Plugins/Flow.Launcher.Plugin.Explorer/Search/ResultManager.cs @@ -1,4 +1,4 @@ -using Flow.Launcher.Core.Resource; +using Flow.Launcher.Core.Resource; using Flow.Launcher.Infrastructure; using Flow.Launcher.Plugin.SharedCommands; using System; @@ -21,23 +21,22 @@ namespace Flow.Launcher.Plugin.Explorer.Search Settings = settings; } - private static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) + public static string GetPathWithActionKeyword(string path, ResultType type, string actionKeyword) { - string keyword; - // Using Quick Access or Index Search action keywords to then navigate to directory - if (actionKeyword == Settings.PathSearchActionKeyword || actionKeyword == Settings.SearchActionKeyword) - { - keyword = actionKeyword == Settings.PathSearchActionKeyword ? $"{actionKeyword} " : string.Empty; - } - else - { - keyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled - ? $"{Settings.PathSearchActionKeyword} " - : Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign - ? string.Empty // Query.ActionKeyword is string.Empty when Global Action Keyword ('*') is used - : $"{Settings.SearchActionKeyword} "; - } + // actionKeyword will be empty string if using global, query.ActionKeyword is "" + var usePathSearchActionKeyword = Settings.PathSearchKeywordEnabled && !Settings.SearchActionKeywordEnabled; + + var pathSearchActionKeyword = Settings.PathSearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty + : $"{Settings.PathSearchActionKeyword} "; + + var searchActionKeyword = Settings.SearchActionKeyword == Query.GlobalPluginWildcardSign + ? string.Empty + : $"{Settings.SearchActionKeyword} "; + + var keyword = usePathSearchActionKeyword ? pathSearchActionKeyword : searchActionKeyword; + var formatted_path = path; if (type == ResultType.Folder)