summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaohan Chen <yaohan.chen@gmail.com>2007-08-10 09:39:17 +0000
committerYaohan Chen <yaohan.chen@gmail.com>2007-08-10 09:39:17 +0000
commitdfcf0ea694815cecd518133c38562d09ae9472c5 (patch)
tree8d79ad923e517756f91712f1a4f1cc0108b612fd
parent529e64cf4b05b4a92f2ce3f575be4332ed0691b5 (diff)
* alias.rb: fixed precedence error which caused list of aliases be reset on rescan
-rw-r--r--data/rbot/plugins/alias.rb5
1 files 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