Archive: Uninstaller not using correct $INSTDIR


Uninstaller not using correct $INSTDIR
I'm trying to get an uninstall script to remove a directory that I currently have installed but its instead entering the directory thinking it is the INSTDIR.

I am trying to get around RMDir /r $INSTDIR by installing my files in a sub directory that is unique and that can be safely removed.

My install script looks like this:

  InstallDir "$PROGRAMFILES\company name"
SetOutPath "$INSTDIR"
File /r "product name"


Which installs the files into "$PROGRAMFILES\company name\product name", but my install dir should still be "$PROGRAMFILES\company name" correct?

My uninstaller is as follows:
  RMDir /r "$INSTDIR\product name"
RMDir "$INSTDIR"


Which I was hoping would just recursively remove the "product name" folder and not the "company name", and then if the "company name" folder is empty remove that too.

But instead it thinks that "$PROGRAMFILES\company name\product name" is the INSTDIR.

Does anyone know what I'm doing wrong? I've been looking a while for a solution for this.

In the uninstaller, $INSTDIR equals the directory where uninstall.exe is stored. You can however do RmDir "$INSTDIR\.." if you want, this works in almost all cases.