From 4df7264c8ae89ada21c95c3a5317de05692cc450 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 15 Jun 2025 01:25:34 +0800 Subject: [PATCH] Improve documents --- Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs | 8 ++++---- Flow.Launcher/PublicAPIInstance.cs | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs index d5efa3c1e..018eff187 100644 --- a/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs +++ b/Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs @@ -593,13 +593,13 @@ namespace Flow.Launcher.Plugin /// /// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator. /// - /// File path + /// File name /// Working directory. If not specified, the current directory will be used /// Optional arguments to pass to the process. If not specified, no arguments will be passed /// Whether to use shell to execute the process /// Verb to use when starting the process, e.g. "runas" for elevated permissions. If not specified, no verb will be used. /// Whether process is started successfully - public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = ""); + public bool StartProcess(string fileName, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = ""); /// /// Start a process with support for handling administrative privileges @@ -607,12 +607,12 @@ namespace Flow.Launcher.Plugin /// /// It can help to start a de-elevated process and show user account control dialog when Flow is running as administrator. /// - /// File path + /// File name /// Working directory. If not specified, the current directory will be used /// Optional argument list to pass to the process. If not specified, no arguments will be passed /// Whether to use shell to execute the process /// Verb to use when starting the process, e.g. "runas" for elevated permissions. If not specified, no verb will be used. /// Whether process is started successfully - public bool StartProcess(string filePath, string workingDirectory = "", Collection argumentList = null, bool useShellExecute = false, string verb = ""); + public bool StartProcess(string fileName, string workingDirectory = "", Collection argumentList = null, bool useShellExecute = false, string verb = ""); } } diff --git a/Flow.Launcher/PublicAPIInstance.cs b/Flow.Launcher/PublicAPIInstance.cs index acfbe9d76..eaeb8fe31 100644 --- a/Flow.Launcher/PublicAPIInstance.cs +++ b/Flow.Launcher/PublicAPIInstance.cs @@ -575,7 +575,7 @@ namespace Flow.Launcher public Task StopwatchLogInfoAsync(string className, string message, Func action, [CallerMemberName] string methodName = "") => Stopwatch.InfoAsync(className, message, action, methodName); - public bool StartProcess(string filePath, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = "") + public bool StartProcess(string fileName, string workingDirectory = "", string arguments = "", bool useShellExecute = false, string verb = "") { try { @@ -587,13 +587,13 @@ namespace Flow.Launcher var result = Win32Helper.RunAsDesktopUser( Constant.CommandExecutablePath, Environment.CurrentDirectory, - $"-StartProcess -FileName {AddDoubleQuotes(filePath)} -WorkingDirectory {AddDoubleQuotes(workingDirectory)} -Arguments {AddDoubleQuotes(arguments)} -UseShellExecute {useShellExecute} -Verb {AddDoubleQuotes(verb)}", + $"-StartProcess -FileName {AddDoubleQuotes(fileName)} -WorkingDirectory {AddDoubleQuotes(workingDirectory)} -Arguments {AddDoubleQuotes(arguments)} -UseShellExecute {useShellExecute} -Verb {AddDoubleQuotes(verb)}", false, true, // Do not show the command window out var errorInfo); if (!string.IsNullOrEmpty(errorInfo)) { - LogError(ClassName, $"Failed to start process {filePath} with error: {errorInfo}"); + LogError(ClassName, $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}: {errorInfo}"); } return result; @@ -601,7 +601,7 @@ namespace Flow.Launcher var info = new ProcessStartInfo { - FileName = filePath, + FileName = fileName, WorkingDirectory = workingDirectory, Arguments = arguments, UseShellExecute = useShellExecute, @@ -612,13 +612,13 @@ namespace Flow.Launcher } catch (Exception e) { - LogException(ClassName, $"Failed to start process {filePath} with arguments {arguments} under {workingDirectory}", e); + LogException(ClassName, $"Failed to start process {fileName} with arguments {arguments} under {workingDirectory}", e); return false; } } - public bool StartProcess(string filePath, string workingDirectory = "", Collection argumentList = null, bool useShellExecute = false, string verb = "") => - StartProcess(filePath, workingDirectory, JoinArgumentList(argumentList), useShellExecute, verb); + public bool StartProcess(string fileName, string workingDirectory = "", Collection argumentList = null, bool useShellExecute = false, string verb = "") => + StartProcess(fileName, workingDirectory, JoinArgumentList(argumentList), useShellExecute, verb); private static string AddDoubleQuotes(string arg) {