summaryrefslogtreecommitdiff
path: root/lib/rbot/registry.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbot/registry.rb')
-rw-r--r--lib/rbot/registry.rb9
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}"