summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2011-11-22 23:07:21 +0100
committerJoel Rosdahl <joel@rosdahl.net>2011-11-23 22:24:48 +0100
commitc71a4f958c469c6c55093bb1295cbd661e72dec1 (patch)
tree3a8ec638dab112702a94e412d96e3965f0e45b24
parent3517616a73f47217f20b7ebe0a1cace73253ef1d (diff)
downloadminiircd-c71a4f958c469c6c55093bb1295cbd661e72dec1.tar.gz
miniircd-c71a4f958c469c6c55093bb1295cbd661e72dec1.zip
Add and use a create_directory function
-rwxr-xr-xminiircd9
1 files 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: