Skip to content

Commit

Permalink
Merge pull request #12688 from Szpoti/fixKnotsOnWIndows
Browse files Browse the repository at this point in the history
Fix wrong `DataDir` error on Windows for Knots
  • Loading branch information
molnard committed Mar 19, 2024
2 parents 8dadf3e + 68aed7a commit 8951440
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using NBitcoin;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using WalletWasabi.Bases;
Expand Down Expand Up @@ -49,7 +50,12 @@ public async Task StartAsync(CancellationToken cancel)
string processPath = MicroserviceHelpers.GetBinaryPath("bitcoind");
string networkArgument = NetworkTranslator.GetCommandLineArguments(Network);

string args = $"{networkArgument} -datadir=\"{DataDir}\" -printtoconsole={ptcv}";
// On Windows, if DataDir ends with '\', the Process can't be started.
string dataDir = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && DataDir.EndsWith('\\')
? DataDir[..^1]
: DataDir;

string args = $"{networkArgument} -datadir=\"{dataDir}\" -printtoconsole={ptcv}";

// Start bitcoind process.
Process = new ProcessAsync(ProcessStartInfoFactory.Make(processPath, args));
Expand Down

0 comments on commit 8951440

Please sign in to comment.