Skip to content

Commit

Permalink
Fix torrc path lookup under Linux
Browse files Browse the repository at this point in the history
Fixes #3.
  • Loading branch information
kzu committed May 19, 2021
1 parent 656d319 commit aad63c9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/dotnet-tor/ConfigCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ async Task RunAsync()
(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
"notepad.exe" : "nano");

var zipName = Path.GetFileNameWithoutExtension(zipPath);
if (zipName.EndsWith(".tar"))
zipName = Path.GetFileNameWithoutExtension(zipName);

var configPath = Path.Combine(
settings.ExtractedToolsDirectory,
Path.GetFileNameWithoutExtension(zipPath),
"Data", "Tor", "torrc");
zipName, "Data", "Tor", "torrc");

var torProxy = new TorSharpProxy(settings);
await torProxy.ConfigureAsync();
Expand Down
7 changes: 5 additions & 2 deletions src/dotnet-tor/TorCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ async Task RunAsync(int proxy, int socks, int control, CancellationToken cancell
await tor.ConfigureAsync();
cancellation.ThrowIfCancellationRequested();

var zipName = Path.GetFileNameWithoutExtension(zipPath);
if (zipName.EndsWith(".tar"))
zipName = Path.GetFileNameWithoutExtension(zipName);

var configPath = Path.Combine(
settings.ExtractedToolsDirectory,
Path.GetFileNameWithoutExtension(zipPath),
"Data", "Tor", "torrc");
zipName, "Data", "Tor", "torrc");

if (!File.Exists(configPath))
throw new ArgumentException($"Tor configuration file not found at expected location {configPath}");
Expand Down

0 comments on commit aad63c9

Please sign in to comment.