Permalink
Browse files

mkdir_p, without wrapping if statement, where needed

  • Loading branch information...
kabaka committed Dec 14, 2015
1 parent 7c02e3b commit 061cbf7da103e2e182fdc782a743ac82aa1a9a9f
Showing with 4 additions and 7 deletions.
  1. +3 −3 lib/database.rb
  2. +1 −4 scripts/chanlog.rb
@@ -67,13 +67,13 @@ def read_database
# Write database in YAML format.
def write_database
FileUtils.mkdir_p File.dirname(@filename) unless Dir.exists? File.dirname(@filename)
FileUtils.mkdir_p File.dirname @filename
temp = "#{@filename}.tmp"
$log.debug("Database.write_database") { "Marshaling data and writing to #{@filename}" }
$log.debug('Database.write_database') { "Marshaling data and writing to #{@filename}" }
File.open(temp, "w") { |f| f.write(@data.to_yaml) }
File.open(temp, 'w') { |f| f.write(@data.to_yaml) }
File.rename temp, @filename
end
@@ -31,10 +31,7 @@
@@loggers = {}
unless Dir.exists? @@log_dir
Dir.mkdir @@log_dir
end
FileUtils.mkdir_p @@log_dir
event :em_started do
# If we're being loaded on a bot that's already running, we're not going

0 comments on commit 061cbf7

Please sign in to comment.