running same tool with differing initial directories
Posted: Wed Oct 22, 2003 4:07 pm
I have duplicate code trees that differ only (for the most part) in the "root" of the code tree. When I'm working on a file and invoke a tool from treeA, I'd like the tool in the root of treeA to be run. When editing a file in treeB, I'd like the tool in the root of treeB to be run.
example:
c:\treeA\x\y\z\myfile.java
c:\treeB\x\y\z\myfile.java
and the I have the follwing batch files:
c:\treeA\mytool.bat
c:\treeB\mytool.bat
in my tool setup, the command to be run is simply mytool.bat but I want the initial folder to be either c:\treeA or c:\treeB depending on which version of myfile.java I'm editing.
$Filedir doesn't work because it will give me the entire c:\treeA\x\y\z or c:\treeB\x\y\z
$Filedir\..\..\.. doesn't work for me (although it would in this case) since working on another file in a different path that doesn't have the same number of directories won't work.
can I run a regex on $Filedir to extract out the root? or would the tool parameter macros have to support it explicitly? something like $filedir[1] = c:\treeA or $filedir[2]=c:\treeA\x etc. etc.
ideas anyone?
example:
c:\treeA\x\y\z\myfile.java
c:\treeB\x\y\z\myfile.java
and the I have the follwing batch files:
c:\treeA\mytool.bat
c:\treeB\mytool.bat
in my tool setup, the command to be run is simply mytool.bat but I want the initial folder to be either c:\treeA or c:\treeB depending on which version of myfile.java I'm editing.
$Filedir doesn't work because it will give me the entire c:\treeA\x\y\z or c:\treeB\x\y\z
$Filedir\..\..\.. doesn't work for me (although it would in this case) since working on another file in a different path that doesn't have the same number of directories won't work.
can I run a regex on $Filedir to extract out the root? or would the tool parameter macros have to support it explicitly? something like $filedir[1] = c:\treeA or $filedir[2]=c:\treeA\x etc. etc.
ideas anyone?