Customize select funtionality in win32 except globally in program, and make code more readable

This commit is contained in:
弘韬 张 2020-11-09 18:12:07 +08:00
parent ead4c9a99b
commit 3d06adebaa
2 changed files with 13 additions and 4 deletions

View file

@ -140,10 +140,19 @@ 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,
!string.IsNullOrWhiteSpace(Main._settings.CustomizedArgs)?Main._settings.CustomizedArgs.Replace("%s",$"\"{ParentDirectory}\"").Replace("%f",$"\"{FullPath}\""):
Settings.ExplorerArgs));
!string.IsNullOrWhiteSpace(Main._settings.CustomizedExplorer)
? Main._settings.CustomizedExplorer
: Settings.Explorer,
args));
return true;
},
IcoPath = "Images/folder.png"

View file

@ -21,7 +21,7 @@ namespace Flow.Launcher.Plugin.Program
internal const string Explorer = "explorer";
internal const string ExplorerArgs = "/select,%f";
internal const string ExplorerArgs = "%s";
/// <summary>
/// Contains user added folder location contents as well as all user disabled applications