common helper for execute shell process from run plugins (#9538)

This commit is contained in:
Davide Giacometti
2021-02-23 09:53:08 +01:00
committed by GitHub
parent 20a922ce21
commit 571bceb386
17 changed files with 77 additions and 128 deletions

View File

@@ -4,7 +4,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO.Abstractions;
using System.Reflection;
using System.Windows;
@@ -112,16 +111,10 @@ namespace Microsoft.Plugin.Folder
AcceleratorModifiers = ModifierKeys.Control | ModifierKeys.Shift,
Action = _ =>
{
try
{
Process.Start("explorer.exe", $" /select,\"{record.FullPath}\"");
}
catch (Exception e)
if (!Helper.OpenInShell("explorer.exe", $"/select,\"{record.FullPath}\""))
{
var message = $"{Properties.Resources.Microsoft_plugin_folder_file_open_failed} {record.FullPath}";
Log.Exception(message, e, GetType());
_context.API.ShowMsg(message);
return false;
}