running same tool with differing initial directories

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
dvheuvel
Posts: 3
Joined: Wed Oct 22, 2003 3:47 pm

running same tool with differing initial directories

Post by dvheuvel »

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?
dvheuvel
Posts: 3
Joined: Wed Oct 22, 2003 3:47 pm

Post by dvheuvel »

I suppose I could maintain 2 workspaces. One in c:\treeA and on in c:\treeB and use the $wspdir macro.

not what I was looking for though.
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

Define a tool for each code tree?

I'm I missing something? Oh well, it's not the first time :oops:
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
bbadmin
Site Admin
Posts: 1038
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Post by bbadmin »

How about passing $FileDir as an extra parameter to a common batch file, which parses the path and calls the correct mytool.bat file?

Keith MacDonald
Helios Software Solutions
dvheuvel
Posts: 3
Joined: Wed Oct 22, 2003 3:47 pm

Post by dvheuvel »

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?
Post Reply