Make get_tor_paths work properly now that in linux the tor binaries are bundled too

This commit is contained in:
Micah Lee 2021-10-11 20:45:28 -07:00
parent fae1f349ee
commit c58272c117
5 changed files with 72 additions and 33 deletions

View file

@ -205,14 +205,14 @@ class GuiCommon:
"downloads_uploads_not_empty": """
QWidget{
background-color: """
+ history_background_color
+""";
+ history_background_color
+ """;
}""",
"downloads_uploads_empty": """
QWidget {
background-color: """
+ history_background_color
+""";
+ history_background_color
+ """;
border: 1px solid #999999;
}
QWidget QLabel {
@ -263,7 +263,7 @@ class GuiCommon:
+ """;
width: 10px;
}""",
"history_default_label" : """
"history_default_label": """
QLabel {
color: """
+ history_label_color
@ -415,21 +415,20 @@ class GuiCommon:
def get_tor_paths(self):
if self.common.platform == "Linux":
tor_path = shutil.which("tor")
obfs4proxy_file_path = shutil.which("obfs4proxy")
prefix = os.path.dirname(os.path.dirname(tor_path))
tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
elif self.common.platform == "Windows":
return self.common.get_tor_paths()
if self.common.platform == "Windows":
base_path = self.get_resource_path("tor")
tor_path = os.path.join(base_path, "Tor", "tor.exe")
obfs4proxy_file_path = os.path.join(base_path, "Tor", "obfs4proxy.exe")
snowflake_file_path = os.path.join(base_path, "Tor", "snowflake-client.exe")
tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip")
tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6")
elif self.common.platform == "Darwin":
base_path = self.get_resource_path("tor")
tor_path = os.path.join(base_path, "tor")
obfs4proxy_file_path = os.path.join(base_path, "obfs4proxy")
snowflake_file_path = os.path.join(base_path, "snowflake-client")
tor_geo_ip_file_path = os.path.join(base_path, "geoip")
tor_geo_ipv6_file_path = os.path.join(base_path, "geoip6")
elif self.common.platform == "BSD":
@ -437,12 +436,14 @@ class GuiCommon:
tor_geo_ip_file_path = "/usr/local/share/tor/geoip"
tor_geo_ipv6_file_path = "/usr/local/share/tor/geoip6"
obfs4proxy_file_path = "/usr/local/bin/obfs4proxy"
snowflake_file_path = "/usr/local/bin/snowflake-client"
return (
tor_path,
tor_geo_ip_file_path,
tor_geo_ipv6_file_path,
obfs4proxy_file_path,
snowflake_file_path,
)
@staticmethod