1--- a/onionshare_cli/common.py
2+++ b/onionshare_cli/common.py
3@@ -318,73 +318,12 @@ class Common:
4 return path
5
6 def get_tor_paths(self):
7- if self.platform == "Linux":
8- tor_path = shutil.which("tor")
9- if not tor_path:
10- raise CannotFindTor()
11- obfs4proxy_file_path = shutil.which("obfs4proxy")
12- snowflake_file_path = shutil.which("snowflake-client")
13- meek_client_file_path = shutil.which("meek-client")
14- prefix = os.path.dirname(os.path.dirname(tor_path))
15- tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
16- tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
17- elif self.platform == "Windows":
18- # In Windows, the Tor binaries are in the onionshare package, not the onionshare_cli package
19- base_path = self.get_resource_path("tor")
20- base_path = base_path.replace("onionshare_cli", "onionshare")
21- tor_path = os.path.join(base_path, "tor.exe")
22-
23- # If tor.exe isn't there, mayber we're running from the source tree
24- if not os.path.exists(tor_path):
25- self.log(
26- "Common", "get_tor_paths", f"Cannot find tor.exe at {tor_path}"
27- )
28- base_path = os.path.join(os.getcwd(), "onionshare", "resources", "tor")
29-
30- tor_path = os.path.join(base_path, "tor.exe")
31- if not os.path.exists(tor_path):
32- self.log(
33- "Common", "get_tor_paths", f"Cannot find tor.exe at {tor_path}"
34- )
35- raise CannotFindTor()
36-
37- obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy.exe")
38- snowflake_file_path = os.path.join(base_path, "snowflake-client.exe")
39- meek_client_file_path = os.path.join(base_path, "meek-client.exe")
40- tor_geo_ip_file_path = os.path.join(base_path, "geoip")
41- tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
42-
43- elif self.platform == "Darwin":
44- # Let's see if we have tor binaries in the onionshare GUI package
45- base_path = self.get_resource_path("tor")
46- base_path = base_path.replace("onionshare_cli", "onionshare")
47- tor_path = os.path.join(base_path, "tor")
48- if os.path.exists(tor_path):
49- obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy")
50- snowflake_file_path = os.path.join(base_path, "snowflake-client")
51- meek_client_file_path = os.path.join(base_path, "meek-client")
52- tor_geo_ip_file_path = os.path.join(base_path, "geoip")
53- tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
54- else:
55- # Fallback to looking in the path
56- tor_path = shutil.which("tor")
57- if not os.path.exists(tor_path):
58- raise CannotFindTor()
59-
60- obfs4proxy_file_path = shutil.which("obfs4proxy")
61- snowflake_file_path = shutil.which("snowflake-client")
62- meek_client_file_path = shutil.which("meek-client")
63- prefix = os.path.dirname(os.path.dirname(tor_path))
64- tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
65- tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
66-
67- elif self.platform == "BSD":
68- tor_path = "/usr/local/bin/tor"
69- tor_geo_ip_file_path = "/usr/local/share/tor/geoip"
70- tor_geo_ipv6_file_path = "/usr/local/share/tor/geoip6"
71- obfs4proxy_file_path = "/usr/local/bin/obfs4proxy"
72- snowflake_file_path = "/usr/local/bin/snowflake-client"
73- meek_client_file_path = "/usr/local/bin/meek-client"
74+ tor_path = "@tor@/bin/tor"
75+ tor_geo_ip_file_path = "@geoip@/share/tor/geoip"
76+ tor_geo_ipv6_file_path = "@geoip@/share/tor/geoip6"
77+ obfs4proxy_file_path = "@obfs4@/bin/obfs4proxy"
78+ snowflake_file_path = "@snowflake@/bin/snowflake-client"
79+ meek_client_file_path = "@meek@/bin/meek-client"
80
81 return (
82 tor_path,