mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
[PT Run] Open folder using shell instead of explorer.exe (#7292)
* pt run not using explorer.exe for opening path (#4622) * updated explorer action name (#4622)
This commit is contained in:
committed by
GitHub
parent
36dd29c056
commit
b80578b1b9
@@ -2,26 +2,25 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Globalization;
|
||||
using Wox.Plugin;
|
||||
|
||||
namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class CreateOpenCurrentFolderResult : IItemResult
|
||||
{
|
||||
private readonly IExplorerAction _explorerAction;
|
||||
private readonly IShellAction _shellAction;
|
||||
|
||||
public string Search { get; set; }
|
||||
public string Search { get; set; }
|
||||
|
||||
public CreateOpenCurrentFolderResult(string search)
|
||||
: this(search, new ExplorerAction())
|
||||
: this(search, new ShellAction())
|
||||
{
|
||||
}
|
||||
|
||||
public CreateOpenCurrentFolderResult(string search, IExplorerAction explorerAction)
|
||||
public CreateOpenCurrentFolderResult(string search, IShellAction shellAction)
|
||||
{
|
||||
Search = search;
|
||||
_explorerAction = explorerAction;
|
||||
_shellAction = shellAction;
|
||||
}
|
||||
|
||||
public Wox.Plugin.Result Create(IPublicAPI contextApi)
|
||||
@@ -33,7 +32,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
SubTitle = Properties.Resources.wox_plugin_folder_select_folder_first_result_subtitle,
|
||||
IcoPath = Search,
|
||||
Score = 500,
|
||||
Action = c => _explorerAction.ExecuteSanitized(Search, contextApi),
|
||||
Action = c => _shellAction.ExecuteSanitized(Search, contextApi),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class FileItemResult : IItemResult
|
||||
{
|
||||
private static readonly IExplorerAction ExplorerAction = new ExplorerAction();
|
||||
private static readonly IShellAction ShellAction = new ShellAction();
|
||||
|
||||
public string FilePath { get; set; }
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
SubTitle = string.Format(CultureInfo.CurrentCulture, Properties.Resources.wox_plugin_folder_select_file_result_subtitle, FilePath),
|
||||
IcoPath = FilePath,
|
||||
TitleHighlightData = StringMatcher.FuzzySearch(Search, Path.GetFileName(FilePath)).MatchData,
|
||||
Action = c => ExplorerAction.Execute(FilePath, contextApi),
|
||||
Action = c => ShellAction.Execute(FilePath, contextApi),
|
||||
ContextData = new SearchResult { Type = ResultType.File, FullPath = FilePath },
|
||||
};
|
||||
return result;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
{
|
||||
public class FolderItemResult : IItemResult
|
||||
{
|
||||
private static readonly IExplorerAction ExplorerAction = new ExplorerAction();
|
||||
private static readonly IShellAction ShellAction = new ShellAction();
|
||||
|
||||
public FolderItemResult()
|
||||
{
|
||||
@@ -41,7 +41,7 @@ namespace Microsoft.Plugin.Folder.Sources.Result
|
||||
QueryTextDisplay = Path,
|
||||
TitleHighlightData = StringMatcher.FuzzySearch(Search, Title).MatchData,
|
||||
ContextData = new SearchResult { Type = ResultType.Folder, FullPath = Path },
|
||||
Action = c => ExplorerAction.Execute(Path, contextApi),
|
||||
Action = c => ShellAction.Execute(Path, contextApi),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user