From 84ebbd99aea997a1cd54f0aebb6740c06df565f8 Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Sat, 6 Nov 2021 01:10:29 -0500 Subject: [PATCH] Migrate Program Plugin Custom Explorer --- Plugins/Flow.Launcher.Plugin.Program/Main.cs | 2 +- .../Flow.Launcher.Plugin.Program/Programs/UWP.cs | 9 +-------- .../Programs/Win32.cs | 15 +-------------- .../Views/ProgramSetting.xaml | 10 ---------- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/Plugins/Flow.Launcher.Plugin.Program/Main.cs b/Plugins/Flow.Launcher.Plugin.Program/Main.cs index 5a8a65985..32c345e95 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Main.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Main.cs @@ -26,7 +26,7 @@ namespace Flow.Launcher.Plugin.Program private static bool IsStartupIndexProgramsRequired => _settings.LastIndexTime.AddDays(3) < DateTime.Today; - private static PluginInitContext _context; + internal static PluginInitContext Context { get; private set; } private static BinaryStorage _win32Storage; private static BinaryStorage _uwpStorage; diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs index 917ebe7ad..e96a8b85a 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/UWP.cs @@ -362,14 +362,7 @@ namespace Flow.Launcher.Plugin.Program.Programs Action = _ => { - Main.StartProcess(Process.Start, - new ProcessStartInfo( - !string.IsNullOrEmpty(Main._settings.CustomizedExplorer) - ? Main._settings.CustomizedExplorer - : Settings.Explorer, - Main._settings.CustomizedArgs - .Replace("%s",$"\"{Package.Location}\"") - .Trim())); + Main.Context.API.OpenDirectory(Package.Location); return true; }, diff --git a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs index a09b8c254..213147660 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs +++ b/Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs @@ -177,20 +177,7 @@ namespace Flow.Launcher.Plugin.Program.Programs Title = api.GetTranslation("flowlauncher_plugin_program_open_containing_folder"), Action = _ => { - var args = !string.IsNullOrWhiteSpace(Main._settings.CustomizedArgs) - ? Main._settings.CustomizedArgs - .Replace("%s", $"\"{ParentDirectory}\"") - .Replace("%f", $"\"{FullPath}\"") - : Main._settings.CustomizedExplorer == Settings.Explorer - ? $"/select,\"{FullPath}\"" - : Settings.ExplorerArgs; - - Main.StartProcess(Process.Start, - new ProcessStartInfo( - !string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer) - ? Main._settings.CustomizedExplorer - : Settings.Explorer, - args)); + Main.Context.API.OpenDirectory(ParentDirectory, FullPath); return true; }, diff --git a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml index 0f9fa99ff..9db840ad4 100644 --- a/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml +++ b/Plugins/Flow.Launcher.Plugin.Program/Views/ProgramSetting.xaml @@ -12,7 +12,6 @@ - @@ -77,15 +76,6 @@