Add ensuredirexists, which creates a dir if it doesn't exist, in a race-...

...safe way.

See issue #6.