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?
running same tool with differing initial directories
Moderators: AmigoJack, bbadmin, helios, MudGuard
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
having multiple tools is not what I wanted since I have to keep updating them as I move code trees. might have 4 or more on the go at anyone time. having multiple tools would work, but I think it's the brute force method
this may be the way I have to go...
Keith,
I considered the batch file method, but my tool returns a pathname, relative to my rootpath (in my case c:\treeA). Double clicking on the command window will parse the out the filename, but wouldn't the load the file since the parsed path is relative to c:\treeA and the initial folder (tool setting) is a different directory.
The batch file in question is actually just a grep of a TAGS file I make prior to running the tool (70Meg). So I can't append the rootdir to the command output (easily)
example:
tool: mytool.bat $filedir
initial folder: c:\
output:
x\y\z\someotherfile.java
which I can no longer click on to load the file since the initial folder is c:\ not c:\treeA
am I making sense?
Keith,
I considered the batch file method, but my tool returns a pathname, relative to my rootpath (in my case c:\treeA). Double clicking on the command window will parse the out the filename, but wouldn't the load the file since the parsed path is relative to c:\treeA and the initial folder (tool setting) is a different directory.
The batch file in question is actually just a grep of a TAGS file I make prior to running the tool (70Meg). So I can't append the rootdir to the command output (easily)
example:
tool: mytool.bat $filedir
initial folder: c:\
output:
x\y\z\someotherfile.java
which I can no longer click on to load the file since the initial folder is c:\ not c:\treeA
am I making sense?