The Clarion Advisor: Redirection Files
Posted September 14 1999
I recently settled on a redirection file strategy that I rather like, so I thought I would share it here, for anyone who might find it useful.
Clarion uses redirection files for two reasons: to search for files when a path has not been specified, and to decide where to put any files it creates. The default redirection file (i.e., CLARION5.RED) is in your Clarion \BIN directory, but you can place a copy of the redirection file in your application's directory, if you want to make changes that affect only that application.
It took me a while to understand that all you really need in Clarion is an .APP file and a .DCT file. All the other files in your project get generated for you and can be deleted once in a while to clean things up or, on occasion, to solve problems. So it makes sense to separate these files into their own folder. At first I figured out what the file extensions were and started adding a line in the redirection file for each type of file that I wanted to separate, like the following:
[Common] *.inc = .\src *.clw = .\src *.map = .\src *.shp = .\src ...
This had the effect of creating an \SRC folder below the folder in which my .APP and .DCT files were stored. (Clarion creates this folder automatically, if it doesn't already exist.) Into this folder Clarion generated the files with the extensions listed. But Clarion generates a wide variety of files, and this was getting out of hand. I reached my limit trying to get the shortcut to the .EXE to go into a separate folder.
Then I decided to change my strategy a little. Now, instead of saying what to put where, I tell Clarion to put everything in \SRC, except what I don't want to go there. How do I do that? Well, here is what my Common section looks like now:
[Common] *.exe = . *.dll = .;%ROOT%\bin *.tp? = %ROOT%\template *.trf = %ROOT%\template *.txs = %ROOT%\template *.stt = %ROOT%\template *.* = .\src; .; %ROOT%\examples; %ROOT%\libsrc; %ROOT%\images; %ROOT%\template; %ROOT%\convsrc *.lib = %ROOT%\lib *.obj = %ROOT%\lib *.res = %ROOT%\lib
Only two little differences exist between my version here and the default that is shipped with Clarion. The first change I made was to the *.* line. The original version listed the first directory as just a dot. This meant that all files created by Clarion would be put in the same directory as the .APP file. (Remember that only the first directory listed specifies where files created by the application generator should go.) I added .\SRC to the front of the line, which means, "Put everything in a directory called 'SRC' just below the current directory, and create this directory if it doesn't exist."
The other difference is the one exception I made. I wanted the final .EXE to remain in the same directory as the .APP file, so I added the line:
*.exe = .
If you wanted to keep the ship list file there as well, you could add the line:
*.shp = .
And so forth. Now all the files that Clarion generates go where I want them to go. And, if I start running into weird bugs, I can delete everything in \SRC and recompile. If I want to see the actual code that Clarion generates, perhaps in a different editor, all the .CLW and .INC files are in the \SRC folder. Try it. You might like it.
Article comments
Search ClarionMag
From the archives
Unit Testing Webinar Workshop Takes On Dates/Times
3/31/2011 12:00:00 AM
Recently John Hickey and David Harms hosted a webinar workshop on unit testing, using Pierre du Toit's article on Clarion and Excel dates and times as a source for a utility class. John and Dave learned a few things about the process, and hopefully the participants did too.

by Edvard Korsbfk on December 16 2006 (comment link)
Thanks!
Edvard Korsbæk