Delete view files on database deletion
Delete view files on database deletion

couch_file:nuke_dir attempts to recurse into subdirectories and delete
the contents, it does so when couch_file:delete returns {error,
eperm}. Unfortunately, the subdirectory has been renamed to a random
uuid before returning, and so the recursive call gets {error, enoent}
from list:dir(Path) where Path is the original (non-existent)
subdirectory path.

View files are not currently deleted when a database is because of
this (this happened since 1.2.0, no release is broken) because the
view engine rewrite added a further directory level called 'mrview'.

This patch modifies nuke_dir to depth-first, solving the issue.

fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb