mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-02 07:34:08 +01:00
Updated to allow a dirname, so I can use it later for ChannelLogger.
This commit is contained in:
parent
542a9a8193
commit
3a916b2486
@ -109,20 +109,21 @@ class DBHandler(object):
|
||||
self.cachedDb.die()
|
||||
del self.cachedDb
|
||||
|
||||
def makeChannelFilename(channel, filename):
|
||||
# XXX We should put channel stuff in its own directory.
|
||||
|
||||
def makeChannelFilename(channel, filename, dirname=None):
|
||||
assert filename == os.path.basename(filename), 'We don\'t handle dirs.'
|
||||
channel = ircutils.toLower(channel)
|
||||
if conf.supybot.databases.plugins.channelSpecific.get(channel)():
|
||||
# Should we offer the old #channel-filename naming scheme?
|
||||
dir = conf.supybot.directories.data.dirize(channel)
|
||||
if dirname is None:
|
||||
dir = conf.supybot.directories.data.dirize(channel)
|
||||
else:
|
||||
dir = os.path.join(dirname, channel)
|
||||
if not os.path.exists(dir):
|
||||
os.mkdir(dir)
|
||||
os.makedirs(dir)
|
||||
return os.path.join(dir, filename)
|
||||
else:
|
||||
return conf.supybot.directories.data.dirize(filename)
|
||||
## filename = '%s-%s' % (channel, filename)
|
||||
## return conf.supybot.directories.data.dirize(filename)
|
||||
|
||||
|
||||
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
||||
# want such behavior. But at this point, it wouldn't gain much for us
|
||||
|
Loading…
Reference in New Issue
Block a user