Trouble getting file version
I'm trying to get a file version and after calling GetFileVersion, the return value is always empty. I know the file exists (I've tried this on a number of files) and that there is version data in the file. I've tried using my Var and R0 to capture the result, both return an empty string.
It sounds like maybe I'm not getting the library setup properly (i.e. like having to call StrStr before it will work), but I can't seem to find any hints. Here is a code snippet. The syntax looks pretty straighforward, so I'm not sure what I'm doing wrong. This is just test code now so I'm aborting after some debugging message boxes. I'm on version 2.16.
Any clues?
!include "FileFunc.nsh"
!include "WordFunc.nsh"
!include "TextFunc.nsh"
!include "StrFunc.nsh"
${StrStr} ;Activate the StrStr Function
!insertmacro GetFileVersion
!insertmacro VersionCompare
!insertmacro LineFind
!insertmacro WordReplace
...
...
Function .onInit
Var /GLOBAL INSTALLED_VERSION
IfFileExists "$PROGRAMFILES\foo\foo.exe" 0 NoErrorMsg
; See what version it is
${GetFileVersion} '$PROGRAMFILES\foo\foo.exe' $INSTALLED_VERSION
MessageBox MB_OK "$(INSTALLED_VERSION)"
MessageBox MB_OK "${VERSION}"
Abort
; Check version status
${VersionCompare} $INSTALLED_VERSION ${VERSION} $INSTALLED_VERSION
IntCmp 1 $R0 downgrade upgrade CurrentVer
CurrentVer:
MessageBox MB_OK "current"
Abort
downgrade:
MessageBox MB_OK "older"
Abort
upgrade:
MessageBox MB_OK "Upgrade"
Abort
NoErrorMsg:
FunctionEnd