diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-22 15:35:13 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-07-22 15:35:13 +0000 |
commit | b482ed5c732e5148af342ef12ee8bf1c7acd971c (patch) | |
tree | 096039cbcabaf64242cd9e14b658e6e2559d63b4 /lib/rbot | |
parent | 0eb14d155efce452aa168e047fbd42c963b294af (diff) |
Of course, I forgot about creating the subregistry directories for brand new installations. This fixes it, even though the code should be brought over to dbhash instead of being duplicated all around
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/registry.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/rbot/registry.rb b/lib/rbot/registry.rb index bc52a373..d86850d4 100644 --- a/lib/rbot/registry.rb +++ b/lib/rbot/registry.rb @@ -44,6 +44,7 @@ module Irc prefix.downcase! # subregistries were split with a +, now they are in separate folders if prefix.gsub!(/\+/, "/") + # Ok, this code needs to be put in the db opening routines dirs = File.dirname("#{@bot.botclass}/registry/#{prefix}.db").split("/") dirs.length.times { |i| dir = dirs[0,i+1].join("/")+"/" @@ -122,6 +123,14 @@ module Irc def initialize(bot, name) @bot = bot @name = name.downcase + dirs = File.dirname("#{@bot.botclass}/registry/#{@name}").split("/") + dirs.length.times { |i| + dir = dirs[0,i+1].join("/")+"/" + unless File.exist?(dir) + debug "creating subregistry directory #{dir}" + Dir.mkdir(dir) + end + } @registry = DBTree.new bot, "registry/#{@name}" @default = nil # debug "initializing registry accessor with name #{@name}" |