Blocking appending on install dir on browse
I have an application that nneds to be installed in the same directory as another application.
I have set up the install directory by reading a registry setting for that program as
;Default installation folder
InstallDir "$PROGRAMFILES\${COMPANY_NAME}\${PRODUCT_NAME}"
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Company\Package\Install" "InstallDir"
I then use the standard page, but checks if it's a valid directory
!insertmacro MUI_PAGE_DIRECTORY
Function .onVerifyInstDir
IfFileExists $INSTDIR\TestFile.exe PathGood
Abort ; if $INSTDIR is not a valid directory, don't let user install there.
PathGood:
FunctionEnd
The problem is if the user uses the browse button to look for the directory the directory name gets appended with my appname when the user clicks OK and this is not what I want.
How do I prevent this and install in the directory the user actually selected?