Set script’s working directory based on project/script path

For projects, the working directory will now be set to the project directory, if there is no project then the file’s directory is used, and if running an untitled document, the user’s home directory is used as a last fallback.

Related discussion at http://lists.macromates.com/textmate-dev/2013-May/014885.html