From b482ed5c732e5148af342ef12ee8bf1c7acd971c Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Sat, 22 Jul 2006 15:35:13 +0000 Subject: 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 --- lib/rbot/registry.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/rbot/registry.rb') 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}" -- cgit v1.2.3