From d5f223fc88626cd907629104f89a01c36ae1048e Mon Sep 17 00:00:00 2001 From: Jeremy Wu Date: Sat, 15 Feb 2020 17:23:17 +1100 Subject: [PATCH] Add file path to files search result in Folder Plugin (#139) * Add file path to files in Folder Plugin * Add folder subtitle display path when wildcard '>' is used --- Plugins/Wox.Plugin.Folder/Main.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Plugins/Wox.Plugin.Folder/Main.cs b/Plugins/Wox.Plugin.Folder/Main.cs index 170799029a..53e298eb63 100644 --- a/Plugins/Wox.Plugin.Folder/Main.cs +++ b/Plugins/Wox.Plugin.Folder/Main.cs @@ -17,6 +17,8 @@ namespace Wox.Plugin.Folder public const string DeleteFileFolderImagePath = "Images\\deletefilefolder.png"; public const string CopyImagePath = "Images\\copy.png"; + private string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory"; + private static List _driverNames; private PluginInitContext _context; @@ -86,13 +88,13 @@ namespace Wox.Plugin.Folder return false; } - private Result CreateFolderResult(string title, string path, Query query) + private Result CreateFolderResult(string title, string subtitle, string path, Query query) { return new Result { Title = title, IcoPath = path, - SubTitle = "Ctrl + Enter to open the directory", + SubTitle = subtitle, TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData, Action = c => { @@ -126,7 +128,7 @@ namespace Wox.Plugin.Folder var userFolderLinks = _settings.FolderLinks.Where( x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase)); var results = userFolderLinks.Select(item => - CreateFolderResult(item.Nickname, item.Path, query)).ToList(); + CreateFolderResult(item.Nickname, DefaultFolderSubtitleString, item.Path, query)).ToList(); return results; } @@ -199,6 +201,8 @@ namespace Wox.Plugin.Folder var folderList = new List(); var fileList = new List(); + var folderSubtitleString = DefaultFolderSubtitleString; + try { // search folder and add results @@ -211,7 +215,10 @@ namespace Wox.Plugin.Folder if(fileSystemInfo is DirectoryInfo) { - folderList.Add(CreateFolderResult(fileSystemInfo.Name, fileSystemInfo.FullName, query)); + if (searchOption == SearchOption.AllDirectories) + folderSubtitleString = fileSystemInfo.FullName; + + folderList.Add(CreateFolderResult(fileSystemInfo.Name, folderSubtitleString, fileSystemInfo.FullName, query)); } else { @@ -240,6 +247,7 @@ namespace Wox.Plugin.Folder var result = new Result { Title = Path.GetFileName(filePath), + SubTitle = filePath, IcoPath = filePath, TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData, Action = c =>