I am trying to run my function called UpdateConfigFile using Custom Actions but my function does not seem to get executed at all. I did not have any compilation error nor run-time error.
This is what I did:
1. Created a script called 'UpdateConfigFile.rul' in InstallScript View as below:
-------------------------------------------------------------------------------------------
///////////////////////////////////////////////////////
//
// Function: UpdateConfigFile
// Purpose: Updating the AuthoringManager.exe.config
//
////////////////////////////////////////////////////////
#include "ifx.h"
#include "isrt.h"
#include "iswi.h"
export prototype UpdateConfigFile();
function UpdateConfigFile()
STRING ConfigFile, RepositoryDir, svReturnLine;
INT nvLineNumber, nResult;
begin
ConfigFile = INSTALLDIR + "\\Software\\XXX.config";
RepositoryDir = "<add key=\"AAA\" value= \"\"\" + NEWDIR + \"\"\" />";
nResult = FileGrep(ConfigFile, "AAA", svReturnLine, nvLineNumber, RESTART);
if (nResult = 0) then
if (FileInsertLine(ConfigFile, RepositoryDir, nvLineNumber, REPLACE) < 0) then
MessageBox("Unable to update the default Repository directory in XXX.config file", SEVERE);
endif;
endif;
end;
-----------------------------------------------------------------------------------------
This function is supposed to delete a line in xml config file and replace with another line. NEWDIR is a directory like INSTALLDIR that should hold destination path - this value is from a dialog called AskDestPath2 that I have created (exactly same as default sdAskDestPath dialog) in Setup.rul.
2. Then in Custom Actions View, I have created New InstallScript with properties as below:
- Synchronous (Ignores exit code)
- Deferred Execution
- After InstallFiles.
3. Build & Install.
The end result is that the config file has not been modified at all.
Could anyone tell me what I am doing wrong here please?
I am using Developer 8.02
Many thanks.
Edited by narapark, 13 June 2003 - 15:57.