checkOrCreateDir

Checks if a given directory exists or creates it, if required.

If it is not possible to create the directory, it throws an InternalErrorException.