mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 19:26:39 +02:00
[PowerToysRun] Add version info to plugin error messages (#38491)
* changes * fix resx
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Abstractions;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
@@ -42,6 +44,9 @@ namespace Wox.Plugin
|
||||
|
||||
public string ExecuteFileName { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string ExecuteFileVersion { get; private set; }
|
||||
|
||||
public string PluginDirectory
|
||||
{
|
||||
get
|
||||
@@ -53,6 +58,7 @@ namespace Wox.Plugin
|
||||
{
|
||||
_pluginDirectory = value;
|
||||
ExecuteFilePath = Path.Combine(value, ExecuteFileName);
|
||||
SetExecutableVersion();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,5 +90,19 @@ namespace Wox.Plugin
|
||||
|
||||
[JsonIgnore]
|
||||
public int QueryCount { get; set; }
|
||||
|
||||
private void SetExecutableVersion()
|
||||
{
|
||||
// Using version from plugin metadata json as fallback
|
||||
try
|
||||
{
|
||||
var v = FileVersionInfo.GetVersionInfo(ExecuteFilePath).FileVersion;
|
||||
ExecuteFileVersion = (v is null or "0.0.0.0") ? Version : v;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
ExecuteFileVersion = Version;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user