[PowerToysRun] Add version info to plugin error messages (#38491)

* changes

* fix resx
This commit is contained in:
Heiko
2025-04-16 20:51:20 +02:00
committed by GitHub
parent f65a3fc06f
commit cb27874805
8 changed files with 31 additions and 10 deletions

View File

@@ -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;
}
}
}
}