]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
ircbot.rb: create the appropriate directories when updating botclass dir from template
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 24 Jun 2008 16:53:45 +0000 (18:53 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 24 Jun 2008 16:53:45 +0000 (18:53 +0200)
lib/rbot/ircbot.rb

index 968f35f90fca1e02dcbd2944209e8315e7a35589..3cd41d2e62512ebb42441015777ec2df5950a5b0 100644 (file)
@@ -427,7 +427,9 @@ class Bot
       # keywords.rbot, which gets deleted on load and would therefore be missing always
       missing = Dir.chdir(template) { Dir.glob('*/**') } - Dir.chdir(botclass) { Dir.glob('*/**') }
       missing.map do |f|
-        FileUtils.cp File.join(template, f), File.join(botclass, f)
+        dest = File.join(botclass, f)
+        FileUtils.mkdir_p File.dirname dest
+        FileUtils.cp File.join(template, f), dest
       end
     else
       log "no #{botclass} directory found, creating from templates.."