Detecting XP vs Vista
My installer needs to be able to detect if it is being executed on XP or on Vista so it can provide the appropriate default installation path which the user should be able to modify it.
I can call getOS from within a Section but, by the time the Section code is executed, the MUI_PAGE_DIRECTORY page has already come and gone with the preassigned path. So, the path indicated on the directory page may be wrong (e.g., if it's "C:\Program Files\..." and being installed on a Vista machine) and, worse, any path the user enters is ignored by the Section code that follows.
Is there a way that I can populate $INSTDIR with a value after the OS has been detected but before MUI_PAGE_DIRECTORY is displayed?
I've tried reordering the OS detection section and the various !define MUI_PAGE_... statements and the InstallDir statement but have not been able to come up with a working solution. I have not been able to dig up anything on this topic in the forum or on the web.
I'm using the following code to deal with the OS:
Section "OsDetection"
call getOS
${if} $R0 == "XP"
strcpy $INSTDIR "C:\Program Files\<work>\${PRODUCT_NAME}"
${else}
strcpy $INSTDIR "C:\Users\Public\Public Documents\<work>\${PRODUCT_NAME}"
${EndIf}
SectionEnd