This is a small program which I cooked up to solve a problem with the
installation script of the original Roadshow demo version. That script would
insert the following line into the "S:User-Startup" file:
If EXIST S:Network-Startup
This line is incorrect, since it should have read as follows:
If EXISTS S:Network-Startup
Note the "EXISTS" instead of "EXIST". My problem was to safely repair this
one single line in the "S:User-Startup" file without making much of a fuss.
It turns out that some fussing is required after all...
The enclosed "SearchReplace" program will try to replace text in a file
which matches a certain pattern (case sensitive). The original file contents
can be changed "in place", meaning that after the necessary changes have been
made, the changed version will take the place of the original file (and if no
changes are indeed necessary, the original file will remain untouched).
Great care is taken so as not to delete and not to damage the original file.
Worst case, the original file will remain under a temporary name (such as
"S:User-Startup.save-1") and can be restored manually.
Full source code is provided in case you are curious, or if you want to
check for bugs. I hope that there are none.
Olaf Barthel, January 1st 2013.
|