Skip to content

Commit fc53efd

Browse files
committed
Use new api function to open application
1 parent 100c21a commit fc53efd

File tree

1 file changed

+5
-27
lines changed
  • Plugins/Flow.Launcher.Plugin.Program/Programs

1 file changed

+5
-27
lines changed

Plugins/Flow.Launcher.Plugin.Program/Programs/Win32.cs

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -208,38 +208,16 @@ public Result Result(string query, IPublicAPI api)
208208

209209
private void Launch(bool elevated = false)
210210
{
211-
var info = new ProcessStartInfo
211+
if (Main.IsAdmin && elevated)
212212
{
213-
FileName = FullPath,
214-
WorkingDirectory = ParentDirectory,
215-
UseShellExecute = true,
216-
Verb = elevated ? "runas" : "",
217-
};
218-
219-
if (Main.IsAdmin)
220-
{
221-
if (elevated)
213+
// Since we are already elevated, we need to create UAC dialog manually
214+
if (UACDialog.Show(IcoPath, Name, FullPath) != MessageBoxResult.Yes)
222215
{
223-
// Since we are already elevated, we need to create UAC dialog manually
224-
if (UACDialog.Show(IcoPath, Name, FullPath) != MessageBoxResult.Yes)
225-
{
226-
return;
227-
}
228-
}
229-
else
230-
{
231-
// Use explorer.exe as workaround to start process as standard user
232-
info = new ProcessStartInfo
233-
{
234-
FileName = "explorer.exe",
235-
Arguments = $"\"{FullPath}\"",
236-
WorkingDirectory = ParentDirectory,
237-
UseShellExecute = true,
238-
};
216+
return;
239217
}
240218
}
241219

242-
_ = Task.Run(() => Main.StartProcess(Process.Start, info)).ConfigureAwait(false);
220+
_ = Task.Run(() => Main.Context.API.StartProcess(FullPath, ParentDirectory, "", elevated)).ConfigureAwait(false);
243221
}
244222

245223
public List<Result> ContextMenus(IPublicAPI api)

0 commit comments

Comments
 (0)