summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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