migrate TorData path

This commit is contained in:
j 2016-01-18 13:02:11 +05:30
parent 52bc986260
commit a4de5127dc

View file

@ -1,4 +1,5 @@
import os import os
import re
import sys import sys
import subprocess import subprocess
from threading import Thread from threading import Thread
@ -45,6 +46,15 @@ CookieAuthentication 1
DataDirectory {base}/TorData DataDirectory {base}/TorData
DirReqStatistics 0 DirReqStatistics 0
'''.strip().format(base=settings.data_path)) '''.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 return defaults, torrc
def run(self): def run(self):