mojombo/jekyll — Issue #417: Crash with directory in previous file location.
Author: sporkexec
Created: 2011-10-17 06:39:08+00:00
State: open

If you have a file, then immediately replace the file with a directory and rebuild, Jekyll crashes:
```
% touch top && jekyll && rm top && mkdir top && touch top/bottom && jekyll
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
/usr/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': File exists - /home/jake/test/jekyll/bin/_site/top (Errno::EEXIST)
from /usr/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir'
from /usr/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each'
from /usr/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p'
from /usr/lib/ruby/1.9.1/fileutils.rb:201:in `each'
from /usr/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p'
from /home/jake/test/jekyll/lib/jekyll/static_file.rb:57:in `write'
from /home/jake/test/jekyll/lib/jekyll/site.rb:249:in `block in write'
from /home/jake/test/jekyll/lib/jekyll/site.rb:248:in `each'
from /home/jake/test/jekyll/lib/jekyll/site.rb:248:in `write'
from /home/jake/test/jekyll/lib/jekyll/site.rb:42:in `process'
from ./jekyll:250:in `

'
```

Note that doing the opposite (creating a folder then overwriting with a file) behaves as expected:
```
% mkdir top && touch top/bottom && jekyll && rm -r top && touch top && jekyll
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
```