Merge pull request #2166 from wabbajack-tools/issue-2165

Always use process location for file association
This commit is contained in:
Timothy Baldridge 2022-11-05 07:14:38 -06:00 committed by GitHub
commit 69c383ef94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -132,12 +132,13 @@ namespace Wabbajack
try
{
var assembly = Assembly.GetExecutingAssembly();
var location = assembly.Location;
if (string.IsNullOrWhiteSpace(location))
location = Process.GetCurrentProcess().MainModule?.FileName ?? throw new Exception("Assembly location is unavailable!");
var assemblyLocation = assembly.Location;
var processLocation = Process.GetCurrentProcess().MainModule?.FileName ?? throw new Exception("Process location is unavailable!");
_logger.LogInformation("App Location: {Location}", assembly.Location);
var fvi = FileVersionInfo.GetVersionInfo(location);
_logger.LogInformation("Assembly Location: {AssemblyLocation}", assemblyLocation);
_logger.LogInformation("Process Location: {ProcessLocation}", processLocation);
var fvi = FileVersionInfo.GetVersionInfo(string.IsNullOrWhiteSpace(assemblyLocation) ? processLocation : assemblyLocation);
Consts.CurrentMinimumWabbajackVersion = Version.Parse(fvi.FileVersion);
VersionDisplay = $"v{fvi.FileVersion}";
AppName = "WABBAJACK " + VersionDisplay;
@ -151,7 +152,7 @@ namespace Wabbajack
{
var applicationRegistrationService = _serviceProvider.GetRequiredService<IApplicationRegistrationService>();
var applicationInfo = new ApplicationInfo("Wabbajack", "Wabbajack", "Wabbajack", location);
var applicationInfo = new ApplicationInfo("Wabbajack", "Wabbajack", "Wabbajack", processLocation);
applicationInfo.SupportedExtensions.Add("wabbajack");
applicationRegistrationService.RegisterApplication(applicationInfo);
}