Skip to content
⌘ NSIS Forum Archive

Installer works on XP, not on Server 2003

14 posts

drmth#

Installer works on XP, not on Server 2003

Hi folks,

I did an installer, in which I use the variable $INSTDIR. Through a command line, I can change it (using /D=). Everything is doing well under XP.

Unfortunately, under Server 2003, the variable $INSTDIR is not set and when I print its value, it returns ${INSTDIR}.

Do somebody know why under Server 2003 the installer is going crazy?

Thanks
drmth#
Hi,

I checked one time again, and the problem is the same... Do anybody know what is happening to the installer?

I will try on a new Server 2003. But, i am not sure it will solve the problem.
Anders#
${INSTDIR} would be a define, even if $INSTDIR (a variable, not a define) was broken, it would not print ${INSTDIR} (with those braces)
drmth#
I completely agree with you... This thing is weird. I tried the installer on another machine this morning (still using Server 2003) but the result was the same.

After, I did some tests and $INSTDIR returns a good value when for example, in the command line i write: Installer.exe /D=C:\blablabla
Here, $INSTDIR is C:\blablabla

but if I write: $INSTDIR is C:\ , the value of $INSTDIR will be ${INSTDIR}.

In fact, it takes a good value only if I do not direct $INSTDIR to the root of the disk...

Unfortunaltely, I need to leave $INSTDIR as C:\
drmth#
Unfortunately, the problem is still there.

it does not work on Server 2003. I am going to make another program to know if the problem comes from my program or if Server is a tricky environment.... Because it works on XP...
drmth#
Hi,

I did some change into the code and finally, I am able to set $INSTDIR.

Just to remind the way I proceed:

In the headers of the code:
AllowRootDirInstall true (thx to Anders!!)

In the function .onINIT:
SetOutPath $INSTDIR
${IF} "$INSTDIR" == ""
${ORIF} "$INSTDIR" == "${INSTDIR}"
Strcpy $INSTDIR "C:\"
${ENDIF}

This is the way I did. In you see any mistake do not hesitate to let me know.
I did a little test to know what is inside $INSTDIR, and it seems that if you do not fix it somewhere in your code, it takes some weird values...

Thank you Anders and MSG.
Anders#
You should not be calling SetOutPath $instdir in .oninit since it will create the directory, remove the SetOutPath call
drmth#
Ok I remodeved it from the code...

Now, i'm having trouble to set $Instdir into the code.

It is ok using the command line, but I'd like that if I do not set $Instdir from the command line, $INSTDIR = S:\ by default

I tried to change it into the piece of code i wrote above (by changing C:\ with S:\) but the installer set it directly to C:\

Dou you have any idea?
drmth#
S:\ does not exist on every machine I am going to use. But I must have $INSTDIR set to S:\ by default.

I tried to set it by using Strcpy, but then, the command line is not taken into account.