better temporary directory handling on osx/ios