[SVN] Can't read `$TM_PROJECT_DIRECTORY` in TM2 bundle

Ron DeVera hello at rondevera.com
Wed Apr 25 06:30:36 UTC 2012


Hey there,

I'm having trouble reading `$TM_PROJECT_DIRECTORY` from within another shell
variable. I have a TM2 bundle whose settings contain this:

    {	shellVariables = (
    		{	name = 'TM_TEST_A';
    			value = 'test A: $TM_DIRECTORY';
    		},
    		{	name = 'TM_TEST_B';
    			value = 'test B: $TM_PROJECT_DIRECTORY';
    		}
    	);
    }

Elsewhere in the bundle (in a `Support/` file), I have Ruby like this:

    puts "ENV['TM_TEST_A'] : #{(ENV['TM_TEST_A']).inspect}"
    puts "ENV['TM_TEST_B'] : #{(ENV['TM_TEST_B']).inspect}"
    puts "ENV['TM_PROJECT_DIRECTORY'] :
#{(ENV['TM_PROJECT_DIRECTORY']).inspect}"

When this runs, the `ENV['TM_TEST_A']` and `ENV['TM_PROJECT_DIRECTORY']` output
are correct, but the `ENV['TM_TEST_B']` output fails to read
`$TM_PROJECT_DIRECTORY` from the environment:

    ENV['TM_TEST_A'] : "test A: /path/to/my.tmbundle/Support"
    ENV['TM_TEST_B'] : "test B: "
    ENV['TM_PROJECT_DIRECTORY'] : "/path/to/my.tmbundle"

In the project directory, I tried adding a `.tm_properties` file containing
this:

    # Source: https://gist.github.com/1478685
    projectDirectory = "$CWD"

This didn't seem to affect `$TM_PROJECT_DIRECTORY`, which remains blank.

Has anyone else run into this? This variable worked reliably in TM1, though I
know that projects have been largely rethought in TM2.

Cheers,
Ron


More information about the textmate-dev mailing list