From 417c4f302e334d0a2bc4a33496625eae6d0d8cc9 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 17 Oct 2019 12:39:56 +0100 Subject: default to using a "data directory" for bitbot (~/.bitbot/) --- src/Control.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Control.py') diff --git a/src/Control.py b/src/Control.py index b57c9048..57f48ea4 100644 --- a/src/Control.py +++ b/src/Control.py @@ -39,11 +39,11 @@ class ControlClient(object): class Control(PollSource.PollSource): - def __init__(self, bot: IRCBot.Bot, database_location: str): + def __init__(self, bot: IRCBot.Bot, filename: str): self._bot = bot self._bot.log.hook(self._on_log) - self._socket_location = "%s.sock" % database_location + self._filename = filename self._socket = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) self._clients = {} @@ -53,9 +53,9 @@ class Control(PollSource.PollSource): self._send_action(client, "log", line) def bind(self): - if os.path.exists(self._socket_location): - os.remove(self._socket_location) - self._socket.bind(self._socket_location) + if os.path.exists(self._filename): + os.remove(self._filename) + self._socket.bind(self._filename) self._socket.listen(1) def get_readables(self) -> typing.List[int]: -- cgit v1.3.1-10-gc9f91