Use a real temporary directory if the __DIR__ path is not writable

Hi, we have notices that errors are thrown when the source directory is not writable. We propose to use a real temp dir provided by the system when the default folder is not writable.
Merge pull request #1 from acseo/master

Use a real temporary directory if the __DIR__ path is not writable