move config to data folder, fixes #171

This commit is contained in:
j 2016-01-18 12:04:20 +05:30
commit b05618f50a
7 changed files with 61 additions and 43 deletions

View file

@ -26,8 +26,8 @@ class TorDaemon(Thread):
self.start()
def create_torrc(self):
defaults = os.path.join(settings.config_path, 'torrc-defaults')
torrc = os.path.join(settings.config_path, 'torrc')
defaults = os.path.join(settings.data_path, 'torrc-defaults')
torrc = os.path.join(settings.data_path, 'torrc')
if not os.path.exists(defaults):
with open(defaults, 'w') as fd:
fd.write('''
@ -44,7 +44,7 @@ CookieAuthentication 1
fd.write('''
DataDirectory {base}/TorData
DirReqStatistics 0
'''.strip().format(base=settings.config_path))
'''.strip().format(base=settings.data_path))
return defaults, torrc
def run(self):
@ -85,7 +85,7 @@ class Tor(object):
def connect(self):
self.connected = False
self.dir = os.path.join(settings.config_path, 'tor')
self.dir = os.path.join(settings.data_path, 'tor')
connected = False
for port in (9831, 9151):
try: