Fix LevelDB database creation.

Also, make "mkdir -p" in a portable way.