mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 15:59:48 -05:00
Guess the default socket file path for new versions of Tor Browser in OS X
This commit is contained in:
parent
406fffdb39
commit
d069cc2a29
@ -108,6 +108,7 @@ class Onion(object):
|
||||
|
||||
if self.settings.get('connection_type') == 'automatic':
|
||||
# Automatically try to guess the right way to connect to Tor Browser
|
||||
p = platform.system()
|
||||
|
||||
# Try connecting to control port
|
||||
found_tor = False
|
||||
@ -131,11 +132,19 @@ class Onion(object):
|
||||
except:
|
||||
pass
|
||||
|
||||
# If this still didn't work, try guessing the default socket file path
|
||||
socket_file_path = ''
|
||||
if not found_tor:
|
||||
if p == 'Darwin':
|
||||
socket_file_path = os.path.expanduser('~/Library/Application Support/TorBrowser-Data/Tor/control.socket')
|
||||
|
||||
self.c = Controller.from_socket_file(path=socket_file_path)
|
||||
found_tor = True
|
||||
|
||||
# If connecting to default control ports failed, so let's try
|
||||
# guessing the socket file name next
|
||||
if not found_tor:
|
||||
try:
|
||||
p = platform.system()
|
||||
if p == 'Linux':
|
||||
socket_file_path = '/run/user/{}/Tor/control.socket'.format(os.geteuid())
|
||||
elif p == 'Darwin':
|
||||
|
Loading…
Reference in New Issue
Block a user