cabinet: Make sure that parent directories exist when creating a new directory.