implement mkdtemp method for MinGW

get method from https://github.com/witwall/mktemp
and replace ssh style /temp/ with the real windows temp directory.