From dfcf0ea694815cecd518133c38562d09ae9472c5 Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Fri, 10 Aug 2007 09:39:17 +0000 Subject: * alias.rb: fixed precedence error which caused list of aliases be reset on rescan --- data/rbot/plugins/alias.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb index 218754a6..581cde1f 100644 --- a/data/rbot/plugins/alias.rb +++ b/data/rbot/plugins/alias.rb @@ -43,8 +43,9 @@ class AliasPlugin < Plugin @data_path = "#{@bot.botclass}/alias/" @data_file = "#{@data_path}/aliases.yaml" # hash of alias => command entries + data = nil @aliases = if File.exist?(@data_file) && - data = YAML.load_file(@data_file) && + (data = YAML.load_file(@data_file)) && data.respond_to?(:each_pair) data else @@ -62,7 +63,7 @@ class AliasPlugin < Plugin end def save - Dir.mkdir(@data_path) unless File.exist?(@data_path) + FileUtils.mkdir_p(@data_path) Utils.safe_save(@data_file) {|f| f.write @aliases.to_yaml} end -- cgit v1.2.3