MinGW doesn't have mkdtemp method

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