Move the function mkdirp into common to be generally available.
Use the new common.mkdirp from create_user_directory() from
core/init.lua replacing previous parent directory creation code
within the function.
The previous mkdirp function did not work on Windows where
absolute paths starts with a drive letter. The code from
create_user_directory() did not have this problem but was wrong
in the way it was creating the nested directories.
The new implementation in common.mkdirp fix both problems.
* allow nested directories to be created
* fix / be turned into //
* refactor error handling
* refactor path splitting and mkdir calls
If a path exists it will now return immediately.
* fix typo
* remove possible trailing empty string
* fix bugs with path check