Skip to content

Commit aad63c9

Browse files
committed
Fix torrc path lookup under Linux
Fixes #3.
1 parent 656d319 commit aad63c9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/dotnet-tor/ConfigCommand.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@ async Task RunAsync()
3737
(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ?
3838
"notepad.exe" : "nano");
3939

40+
var zipName = Path.GetFileNameWithoutExtension(zipPath);
41+
if (zipName.EndsWith(".tar"))
42+
zipName = Path.GetFileNameWithoutExtension(zipName);
43+
4044
var configPath = Path.Combine(
4145
settings.ExtractedToolsDirectory,
42-
Path.GetFileNameWithoutExtension(zipPath),
43-
"Data", "Tor", "torrc");
46+
zipName, "Data", "Tor", "torrc");
4447

4548
var torProxy = new TorSharpProxy(settings);
4649
await torProxy.ConfigureAsync();

src/dotnet-tor/TorCommand.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ async Task RunAsync(int proxy, int socks, int control, CancellationToken cancell
6363
await tor.ConfigureAsync();
6464
cancellation.ThrowIfCancellationRequested();
6565

66+
var zipName = Path.GetFileNameWithoutExtension(zipPath);
67+
if (zipName.EndsWith(".tar"))
68+
zipName = Path.GetFileNameWithoutExtension(zipName);
69+
6670
var configPath = Path.Combine(
6771
settings.ExtractedToolsDirectory,
68-
Path.GetFileNameWithoutExtension(zipPath),
69-
"Data", "Tor", "torrc");
72+
zipName, "Data", "Tor", "torrc");
7073

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

0 commit comments

Comments
 (0)