Add GetExecutablepath to Helpers
MODIFY
WalletWasabi.Fluent/Helpers/StartupHelper.cs
WalletWasabi.Fluent/Helpers/StartupHelper.cs
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
+using WalletWasabi.Helpers;
using WalletWasabi.Logging;
namespace WalletWasabi.Fluent.Helpers
@@ -16,8 +17,7 @@ namespace WalletWasabi.Fluent.Helpers
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- Assembly assembly = Assembly.GetEntryAssembly() ?? throw new NullReferenceException();
- string pathToExeFile = assembly.Location[..^4] + ".exe";
+ string pathToExeFile = EnvironmentHelpers.GetExecutablePath();
if (File.Exists(pathToExeFile))
{
return TryModifyRegistry(runOnSystemStartup, pathToExeFile);
@@ -29,11 +29,11 @@ namespace WalletWasabi.Fluent.Helpers
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
- // Method call here
+ throw new NotImplementedException();
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
- // Method call here
+ throw new NotImplementedException();
}
return false;

MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -24,7 +24,7 @@ namespace WalletWasabi.Packager
public const bool DoRestoreProgramCs = false;
public const string PfxPath = "C:\\digicert.pfx";
- public const string ExecutableName = "wassabee";
+ public const string ExecutableName = Constants.ExecutableName;
// https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog
// BOTTLENECKS:

MODIFY
WalletWasabi/Helpers/Constants.cs
WalletWasabi/Helpers/Constants.cs
@@ -49,6 +49,7 @@ namespace WalletWasabi.Helpers
public const string AlphaNumericCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
public const string CapitalAlphaNumericCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+ public const string ExecutableName = "wassabee";
public const string BuiltinBitcoinNodeName = "Bitcoin Knots";
public static readonly Version ClientVersion = new(1, 1, 12, 9);

MODIFY
WalletWasabi/Helpers/EnvironmentHelpers.cs
WalletWasabi/Helpers/EnvironmentHelpers.cs
@@ -3,6 +3,7 @@ using System;
using System.Collections.Concurrent;
using System.Diagnostics;
using System.IO;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -219,6 +220,20 @@ namespace WalletWasabi.Helpers
return fullBaseDirectory;
}
+ public static string GetExecutablePath()
+ {
+ var fullBaseDir = GetFullBaseDirectory();
+ var wassabeeFileName = Path.Combine(fullBaseDir, Constants.ExecutableName);
+ wassabeeFileName = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"{wassabeeFileName}.exe" : $"{wassabeeFileName}";
+ if (File.Exists(wassabeeFileName))
+ {
+ return wassabeeFileName;
+ }
+ var assemblyName = Assembly.GetEntryAssembly()?.GetName().Name ?? throw new NullReferenceException("Assembly or Assembly's Name was null.");
+ var fluentExecutable = Path.Combine(fullBaseDir, assemblyName);
+ return RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? $"{fluentExecutable}.exe" : $"{fluentExecutable}";
+ }
+
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);

Add GetExecutablepath to Helpers