From a4de5127dcc28449c8d1555819e13bd37785a245 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 18 Jan 2016 13:02:11 +0530 Subject: [PATCH] migrate TorData path --- oml/tor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/oml/tor.py b/oml/tor.py index 8ce89de..d43df76 100644 --- a/oml/tor.py +++ b/oml/tor.py @@ -1,4 +1,5 @@ import os +import re import sys import subprocess from threading import Thread @@ -45,6 +46,15 @@ CookieAuthentication 1 DataDirectory {base}/TorData DirReqStatistics 0 '''.strip().format(base=settings.data_path)) + else: + with open(torrc, 'r') as fd: + data = fd.read() + modified_data = re.sub('DataDirectory.*?/TorData', + 'DataDirectory {base}/TorData'.format(base=settings.data_path), data) + if data != modified_data: + with open(torrc, 'w') as fd: + fd.write(modified_data) + return defaults, torrc def run(self):