Archive: $INSTALL DIR depending on User Status


$INSTALL DIR depending on User Status
Hi evryone
I really hope someone could help me for my problem
I would like to put a default path in the installer depending on the status of the user

** If the user is Administrator $INSTDIR would have the value $PROGRAMFILES

** If the user is NOT Administrator $INSTDIR would have the value $APPDATA

In order to realize that I compute this section


section "Default Directory"

userInfo::getAccountType
pop $0
strCmp $0 "Admin" +2

StrCpy $INSTDIR "$APPDATA\myproject"
StrCpy $INSTDIR "$PROGRAMFILES\myproject"


sectionEnd

I can't access the value of $INSTDIR and i don tknow if this section is working

Someone has a suggestion??
Thank you


Use LogicLib.

Stu


Function getAccountType

userInfo::getAccountType
pop $0
strCmp $0 "Admin" +2


${if} $0 == administrator (not the value but you get what i mean)
StrCpy $INSTDIR "$PROGRAMFILES\myproject"
${else}
StrCpy $INSTDIR "$APPDATA\myproject"
FunctionEnd


Then just call the function during the install process right before the files are installed.

To find out what to set $0 equal to, run a message box displaying the value. Make sure to use global variables as well.


Actually $0 will be 'Admin'. You don't need the StrCmp in that code and also you've missed an ${EndIf}.

Stu