Archive: How to find a path of a application?


How to find a path of a application?
Hi all,

I'm using NSIS to install my application, which is composed by Perl Scripts in a particular directory.
Moreover, I want to add some libraries in the Perl directory which is often "C:/Perl/Lib" but not always. So I want the installshield to be able to find itself what is the correct path of this directory...
Do you know a way to perform that?

Thanks U by advance!

TigreRouge


Check your registry. If you can get the correct key use ReadRegStr.

-Stu


I try
InstallDirRegKey HKLM Software\Perl ""
and it seems working

However, I'm facing another problem :
I want to specify 2 DIFFERENT InstallDir
"$PROGRAMFILES\Apache Group\Apache2\" and then "C:\Perl" because I have 2 pages MUI_PAGE_INSTFILES...

But NSIS takes only the last I specify... Does someone know how to specify 2 different InstallDir?

Thx U!

TR


Just use MUI_UNPAGE_DIRECTORY more than once with two sepate directory variables (one for each isntallation path.)

Directory variables can be set using !define MUI_DIRECTORYPAGE_VARIABLE $varname before each page. (replace '$varname' with the actual variable you want to use for each page.)


Then to set the directory you want, StrCpy $varname "path" in the directory pages' PRE function (!define MUI_PAGE_CUSTOMFUNCTION_PRE FuncName).

e.g.


!define INSTDIR1 "$PROGRAMFILES\Apache Group\Apache2"
!define INSTDIR2 "C:\Perl"
Var INSTDIR2

InstallDir "${INSTDIR1}"

!insertmacro MUI_PAGE_DIRECTORY

!define MUI_DIRECTORYPAGE_VARIABLE $INSTDIR2
!define MUI_PAGE_CUSTOMFUNCTION_PRE DirectoryPre
!insertmacro MUI_PAGE_DIRECTORY

Function DirectoryPre
StrCpy $INSTDIR2 "${INSTDIR2}"
FunctionEnd


-Stu