> I need a play-by-play - what does it do?
Maybe it makes the most sense if I drill down.
1.
The high-level explanation is, that it pauses with a warning if it finds the bug, and then finishes.
If it does not find the bug, then it displays a 2-second "OK" message and just finishes.
The macro will not work if you make it part of another macro, because then its references to CurrMacroFilename() will no longer work correctly.
2.
The mid-level explanation is, that it reproduces the steps as described in the second bullet-point of the TSE help topic "Augmenting the Editor Load Directory", but minus the 3 copy statements that are unnecessary for just a test, and plus a temporary rename of tseload.dat to avoid unnecessary error-messages from not-found autoload macros, and plus a Dos() call of TSE itself with a "new" macro, that reproduces the bug (or not) with a SearchPath() of the new macro itself.
Steps:
The macro sanity_tseloaddir is compiled and executed.
Because the macro sees that it is not started from the command line, it starts prepping the bug-reproducing environment.
It creates a new temporary directory tmp_dir based on the user's environment.
In directory tmp_dir it creates a sanity_tseloaddir.cmd file.
The contents of sanity_tseloaddir.cmd are also based on the user's environment, for example:
C:
cd <tmp_dir>
set TSE_LOADDIR=<tmp_dir>
<path to>\g32 -e<path to>\mac\sanity_tseloaddir.mac
(Calling TSE with a TSELOADDIR environment string, that points to an empty directory, would triggers the bug when TSE searches for macros, but we gave it a start-up macro with a hard path.)
Around calling sanity_tseloaddir.cmd, the file tseload.dat is temporarily renamed, so that the new TSE session will not try to search and load TSE's AutoLoad List macros, and thereby prematurely trigger the bug too many times.
Then we do it:
Macro sanity_tseloaddir.s in the 1st TSE session calls command file sanity_tseloaddir.cmd, which starts a 2nd TSE session with a prepped TSELOADDIR environment and the start-up macro <full path>\sanity_tseloaddir.mac.
This time around, because sanity_tseloaddir.s sees that it is started from the command-line, it simply tests the bug with a SearchPath() statement that simulates how TSE searches for macros.
If the SearchPath() fails, then it pauses with a warning, otherwise it only displays a 2-second "OK" message.
Then this 2nd instance of the macro abandons the 2nd instance of TSE (and thus itself).
This ends sanity_tseloaddir.cmd, returning control to sanity_tseloaddir.s in 1st TSE session.
The macro cleans up the temporary directory and exits.
This seems enough detail for now.
Let me know of any points that need further clarification.
Carlo