mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
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
This commit is contained in:
@@ -17,6 +17,8 @@ namespace Wox.Plugin.Folder
|
|||||||
public const string DeleteFileFolderImagePath = "Images\\deletefilefolder.png";
|
public const string DeleteFileFolderImagePath = "Images\\deletefilefolder.png";
|
||||||
public const string CopyImagePath = "Images\\copy.png";
|
public const string CopyImagePath = "Images\\copy.png";
|
||||||
|
|
||||||
|
private string DefaultFolderSubtitleString = "Ctrl + Enter to open the directory";
|
||||||
|
|
||||||
private static List<string> _driverNames;
|
private static List<string> _driverNames;
|
||||||
private PluginInitContext _context;
|
private PluginInitContext _context;
|
||||||
|
|
||||||
@@ -86,13 +88,13 @@ namespace Wox.Plugin.Folder
|
|||||||
return false;
|
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
|
return new Result
|
||||||
{
|
{
|
||||||
Title = title,
|
Title = title,
|
||||||
IcoPath = path,
|
IcoPath = path,
|
||||||
SubTitle = "Ctrl + Enter to open the directory",
|
SubTitle = subtitle,
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, title).MatchData,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
{
|
{
|
||||||
@@ -126,7 +128,7 @@ namespace Wox.Plugin.Folder
|
|||||||
var userFolderLinks = _settings.FolderLinks.Where(
|
var userFolderLinks = _settings.FolderLinks.Where(
|
||||||
x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
x => x.Nickname.StartsWith(search, StringComparison.OrdinalIgnoreCase));
|
||||||
var results = userFolderLinks.Select(item =>
|
var results = userFolderLinks.Select(item =>
|
||||||
CreateFolderResult(item.Nickname, item.Path, query)).ToList();
|
CreateFolderResult(item.Nickname, DefaultFolderSubtitleString, item.Path, query)).ToList();
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,6 +201,8 @@ namespace Wox.Plugin.Folder
|
|||||||
var folderList = new List<Result>();
|
var folderList = new List<Result>();
|
||||||
var fileList = new List<Result>();
|
var fileList = new List<Result>();
|
||||||
|
|
||||||
|
var folderSubtitleString = DefaultFolderSubtitleString;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// search folder and add results
|
// search folder and add results
|
||||||
@@ -211,7 +215,10 @@ namespace Wox.Plugin.Folder
|
|||||||
|
|
||||||
if(fileSystemInfo is DirectoryInfo)
|
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
|
else
|
||||||
{
|
{
|
||||||
@@ -240,6 +247,7 @@ namespace Wox.Plugin.Folder
|
|||||||
var result = new Result
|
var result = new Result
|
||||||
{
|
{
|
||||||
Title = Path.GetFileName(filePath),
|
Title = Path.GetFileName(filePath),
|
||||||
|
SubTitle = filePath,
|
||||||
IcoPath = filePath,
|
IcoPath = filePath,
|
||||||
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
|
TitleHighlightData = StringMatcher.FuzzySearch(query.Search, Path.GetFileName(filePath)).MatchData,
|
||||||
Action = c =>
|
Action = c =>
|
||||||
|
|||||||
Reference in New Issue
Block a user