Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/bridge-folder-fix'
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Nov 7, 2024
2 parents b571b4f + 0abbf64 commit 87c6cb8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions DragonFruit.OnionFruit/Services/TransportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ namespace DragonFruit.OnionFruit.Services
{
public class TransportManager
{
private const string TransportsDirectory = "pluggable_transports";

public TransportManager(ExecutableLocator locator, ILogger<TransportManager> logger)
{
// locate and read pt_config.json
Expand Down Expand Up @@ -69,9 +67,13 @@ public TransportManager(ExecutableLocator locator, ILogger<TransportManager> log
logger.LogWarning("Cannot use transport {TransportType} as the required engine {Engine} is not available", transport, metadata.TransportEngine);
}

// determine the relative path to the transport directory from the tor executable
var torExecutableDirectory = Path.GetDirectoryName(locator.LocateExecutableInstancesOf("tor").First());
var relTransportDirectory = Path.GetRelativePath(torExecutableDirectory, Path.GetDirectoryName(ptConfigLocation)).TrimEnd(Path.DirectorySeparatorChar);

// set properties
AvailableTransports = availableTransports.ToFrozenDictionary();
TransportConfigLines = Config.PluggableTransports.ToFrozenDictionary(x => x.Key, x => x.Value.Replace("${pt_path}", $"{TransportsDirectory}{Path.DirectorySeparatorChar}"));
TransportConfigLines = Config.PluggableTransports.ToFrozenDictionary(x => x.Key, x => x.Value.Replace("${pt_path}", $"{relTransportDirectory}{Path.DirectorySeparatorChar}"));

if (recommendedTransport.HasValue && !availableTransports.ContainsKey(recommendedTransport.Value))
{
Expand Down

0 comments on commit 87c6cb8

Please sign in to comment.