From c71a4f958c469c6c55093bb1295cbd661e72dec1 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Tue, 22 Nov 2011 23:07:21 +0100 Subject: Add and use a create_directory function --- miniircd | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/miniircd b/miniircd index f0d5a01..df7bbcb 100755 --- a/miniircd +++ b/miniircd @@ -33,6 +33,11 @@ from datetime import datetime from optparse import OptionParser +def create_directory(path): + if not os.path.isdir(path): + os.makedirs(path) + + class Channel(object): def __init__(self, server, name): self.server = server @@ -577,8 +582,8 @@ class Server(object): self.channels = {} # irc_lower(Channel name) --> Channel instance. self.clients = {} # Socket --> Client instance. self.nicknames = {} # irc_lower(Nickname) --> Client instance. - if self.logdir and not os.path.isdir(self.logdir): - os.makedirs(self.logdir) + if self.logdir: + create_directory(self.logdir) def daemonize(self): try: -- cgit v1.2.3