WARNING: This server is unstable and will be retired in the next days. If you want to keep this forum available, please request immediately a migration on the Nabble Support forum. Forums that don't receive any migration request will be deleted forever.

 « Return to Thread: Can't read `$TM_PROJECT_DIRECTORY` in TM2 bundle

Can't read `$TM_PROJECT_DIRECTORY` in TM2 bundle

by Ron DeVera :: Rate this Message:

| View in Thread

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
_______________________________________________
textmate-dev mailing list
textmate-dev@...
http://lists.macromates.com/listinfo/textmate-dev

 « Return to Thread: Can't read `$TM_PROJECT_DIRECTORY` in TM2 bundle