diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2011-11-22 23:07:21 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2011-11-23 22:24:48 +0100 |
commit | c71a4f958c469c6c55093bb1295cbd661e72dec1 (patch) | |
tree | 3a8ec638dab112702a94e412d96e3965f0e45b24 | |
parent | 3517616a73f47217f20b7ebe0a1cace73253ef1d (diff) | |
download | miniircd-c71a4f958c469c6c55093bb1295cbd661e72dec1.tar.gz miniircd-c71a4f958c469c6c55093bb1295cbd661e72dec1.zip |
Add and use a create_directory function
-rwxr-xr-x | miniircd | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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: |