mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Add error info when file/application can't be open
1. Fix #492 2. FIx #478
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@@ -56,13 +57,24 @@ namespace Wox.Plugin.Everything
|
||||
r.IcoPath = GetIconPath(s);
|
||||
r.Action = c =>
|
||||
{
|
||||
_context.API.HideApp();
|
||||
Process.Start(new ProcessStartInfo
|
||||
bool hide;
|
||||
try
|
||||
{
|
||||
FileName = path,
|
||||
UseShellExecute = true
|
||||
});
|
||||
return true;
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = path,
|
||||
UseShellExecute = true
|
||||
});
|
||||
hide = true;
|
||||
}
|
||||
catch (Win32Exception)
|
||||
{
|
||||
var name = $"Plugin: {_context.CurrentPluginMetadata.Name}";
|
||||
var message = "Can't open this file";
|
||||
_context.API.ShowMsg(name, message, string.Empty);
|
||||
hide = false;
|
||||
}
|
||||
return hide;
|
||||
};
|
||||
r.ContextData = s;
|
||||
results.Add(r);
|
||||
|
||||
Reference in New Issue
Block a user