Archive: InstallDir problem


InstallDir problem
Hi,
I have a problem with Windows XP. After a successful installation, I change a path in a file according to the install dir.

But if the user changed the path, NSIS installs correctly to the new path but the line in the file is still the default path.

It works fine under Win2000 but not under XP.
This is the code:

I define the install directory as default and the user can overwrite it:
InstallDir "$PROGRAMFILES\${MUI_PRODUCT}"

Here, I open a file in a .onInstSuccess function. This works with the default install directory and if the user changed this dir.
FileOpen $0 "$INSTDIR\Apache\conf\httpd.conf" "r"

But in the same function I want to change a line *in* a file. Here, NSIS always uses the default folder and not the customized folder if the user changed it.
FileWrite $1 "ServerRoot $\"$INSTDIR\Apache$\"$\r$\n"


Do you know that problem?

Cheers,
Ben


You save the open file handle into $0 but use $1 with FileWrite. If that's not the problem, attach the entire script because a lot of details are missing.


can't be the problem:
he opens a file with "r"(read-only) to $0.
so the FileWrite command _must_ be for another file ($1).