Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using TextMate 2.0-alpha.9427 on OS X 10.8.2. Since two days, when I run a script (Python or shell script), instead of the directory of the script itself, the current working directory is something like /private/var/folders/0r/y4qmws5d2tjdkqzlb19_ny1h0000gn/T.

I think this behaviour appeared with the last TextMate alpha release, but reverting to the previous version was useless. Any ideas?

share|improve this question
1  
As TextMate 2 is bleeding edge alpha, you should probably file a bug with them instead. –  slhck Jun 3 '13 at 13:20
    
@slhck Well, I'm not sure this is a bug. May be I just need to tweak some environment variable in the prefs. I'll surely file a bug otherwise. Thanks! –  Aristide Jun 3 '13 at 14:11

1 Answer 1

up vote 2 down vote accepted

https://github.com/textmate/textmate/blob/master/Applications/TextMate/about/Changes.md:

The working directory of the command being executed is unspecified except for drop commands (where it is the parent of the current file). We have never documented what the working directory is set to, and if you need it to be set to something specific (e.g. TM_PROJECT_DIRECTORY) then you should set it yourself.

I don't know how you're supposed to change the working directory though. Setting PWD to $TM_PROJECT_DIRECTORY in the variables tab didn't work. As a temporary measure, I added this to the commands for running scripts in the Ruby and shell script bundles:

Dir.chdir(ENV["TM_PROJECT_DIRECTORY"])
share|improve this answer
    
Thanks! Following your advice, I've added the following to the command for running Python scripts: Dir.chdir(ENV["TM_DIRECTORY"]) (i.e., the folder of the current document). It works fine! –  Aristide Jun 4 '13 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.