I'm working on a command that I'd like to be able to apply to all files in my project. Looking at the env vars I only see items for working with the current file. Is there any way to get a list of all files in the current project?
It is certainly possible this sort of thing is available somewhere in the shared support ... how do I get more info about what's there? Thanks!
On 2009-Mar-1, at 1:39 PM, Robert J. Carr wrote:
I'm working on a command that I'd like to be able to apply to all files in my project. Looking at the env vars I only see items for working with the current file. Is there any way to get a list of all files in the current project?
It depends on what language you're writing the command with, but if it were a shell script for example, you could get a list of all files in the project with:
find $TM_PROJECT_DIRECTORY
It is certainly possible this sort of thing is available somewhere in the shared support ... how do I get more info about what's there?
Not sure, short of exploring the directory manually, but you can always see what variables are set by running the "Show TM_* Variables" command in the "Bundle Development" bundle. Maybe you already knew that.
Thanks Rob ... a couple comments:
I'm working on a command that I'd like to be able to apply to all files in my project. Looking at the env vars I only see items for working with the current file. Is there any way to get a list of all files in the current project?
It depends on what language you're writing the command with, but if it were a shell script for example, you could get a list of all files in the project with:
find $TM_PROJECT_DIRECTORY
But your project directory doesn't necessarily have anything to do with the files in your project. The best I could come up with is to inspect your tmproj file (TM_PROJECT_FILEPATH) as that lists (in xml/plist) the relative folders/files you've added to your project.
I guess my question is ... is the contents of this flle already parsed and made available somehow or would I need to parse it again?
Not sure, short of exploring the directory manually, but you can always see what variables are set by running the "Show TM_* Variables" command in the "Bundle Development" bundle. Maybe you already knew that.
I was looking for something that described what is available at a high level. I'm fine with digging around. :)
Thanks- Robert
On 2009-Mar-1, at 9:59 PM, Robert J. Carr wrote:
But your project directory doesn't necessarily have anything to do with the files in your project.
Ah, sorry. Most of my projects are directories and not collections of arbitrary files, so I forget about that option sometimes.
The best I could come up with is to inspect your tmproj file (TM_PROJECT_FILEPATH) as that lists (in xml/plist) the relative folders/files you've added to your project.
That's probably what I'd do, but hopefully someone will chime in if there's a better way.
I guess my question is ... is the contents of this flle already parsed and made available somehow or would I need to parse it again?
Again, I'm not an authority on this, but I've never known any information of this sort to be made available as anything other than a TM_ variable, so if it's not there…
Not sure, short of exploring the directory manually, but you can always see what variables are set by running the "Show TM_* Variables" command in the "Bundle Development" bundle. Maybe you already knew that.
I was looking for something that described what is available at a high level. I'm fine with digging around. :)
That would be nice, but if it exists, I can't find it.
On 2 Mar 2009, at 03:59, Robert J. Carr wrote:
[...] But your project directory doesn't necessarily have anything to do with the files in your project. [...]
This will however be the case in the future.
The best I could come up with is to inspect your tmproj file (TM_PROJECT_FILEPATH) as that lists (in xml/plist) the relative folders/files you've added to your project.
I guess my question is ... is the contents of this flle already parsed and made available somehow or would I need to parse it again?
The best is the each_text_file helper in Support/lib/textmate.rb which iterates the files and respect file/folder patterns, but it does not parse tmproj. If you do write code to parse the tmproj file, I’d gladly accept a patch for textmate.rb to precisely mimic the project, but as said above, in the future I do not plan to support project files.