use local tor if no registed version can be found

This commit is contained in:
j 2016-01-17 12:28:55 +05:30
commit 021c418622
2 changed files with 9 additions and 3 deletions

View file

@ -215,7 +215,7 @@ def get_tor():
if sys.platform == 'darwin':
for path in (
'/Applications/TorBrowser.app/TorBrowser/Tor/tor',
os.path.join(settings.base_dir, 'tor', 'TorBrowser.app/TorBrowser/Tor/tor')
os.path.join(settings.base_dir, 'tor', 'TorBrowser.app', 'TorBrowser', 'Tor', 'tor')
):
if os.path.isfile(path) and os.access(path, os.X_OK):
return path
@ -231,6 +231,10 @@ def get_tor():
return path
except:
pass
local_tor = os.path.normpath(os.path.join(settings.base_dir, '..',
'tor', 'tor-browser_en-US', 'Browser', 'TorBrowser', 'Tor', 'tor'))
if os.path.exists(local_tor):
return local_tor
return distutils.spawn.find_executable('tor')
def install_tor():