Archive: root drive as INSTDIR


root drive as INSTDIR
Hi,
does anyone know a how to set the INSTDIR to be the root drive (like C:\ or D:\ depending on where the Windows has been installed). I try to find a variable for this, but I only found $WINDIR or $SYSDIR. I need to use a variable instead of just type hardcoded value C:\


Might no work under 98/ME

OutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true

page directory
page instfiles

Function .onInit
ReadEnvStr $INSTDIR SYSTEMDRIVE
FunctionEnd

Section "boo"
SetOutPath "$INSTDIR"
SectionEnd


Works in all Windows versions
OutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true

page directory
page instfiles

Function .onInit
StrCpy $INSTDIR "$WINDIR" 2
FunctionEnd

Section "boo"
SetOutPath "$INSTDIR"
SectionEnd

Re: root drive as INSTDIR

Originally posted by aditu.g
Hi,
does anyone know a how to set the INSTDIR to be the root drive (like C:\ or D:\ depending on where the Windows has been installed). I try to find a variable for this, but I only found $WINDIR or $SYSDIR. I need to use a variable instead of just type hardcoded value C:\
Hi,

with $WINDIR and the GetRoot macro, you should be able to retrieve the root drive.

Now, I'm not sure that it's good practice to set the INSTDIR to the rootdrive. :o

KenA

Yes, I can use one of the solution posted above, but both are not allowed to be used outside sections.
I would like to define the InstallDir as "%rootdrive%\my application" and then on installation time if the person who install it want, to be possible to change.
I have attached the script to be more specific.


Originally posted by aditu.g
Yes, I can use one of the solution posted above, but both are not allowed to be used outside sections.
I would like to define the InstallDir as "%rootdrive%\my application" and then on installation time if the person who install it want, to be possible to change.
I have attached the script to be more specific.

!define MY_APP "My application Name"
OutFile 'test.exe'
ShowInstDetails show
AllowRootDirInstall true

page directory
page instfiles

Function .onInit
StrCpy "$INSTDIR" "$WINDIR" 2
StrCpy "$INSTDIR" "$INSTDIR\${MY_APP}"
FunctionEnd

Section "boo"
SetOutPath "$INSTDIR"
SectionEnd

Done. I get rid of the InstallDir and use only $INSTDIR. It seems that it is used also on the choose directory page so it better like this. Sorry to waste forum space for such stupid question, but this root installation poped out with Vista. NSIS installer is able to do the installation using RequestExecutionLevel admin but then if you install the app on program files and on runtime wants to write there it will not work, that's why I wanted to install it on the system root (not directly there but in a folder :)