Archive: Problem with path when building on Windows 7, 64 bit


Problem with path when building on Windows 7, 64 bit
In building my installer I have to include some files from a 32-bit library located in Program Files. Because my system is a Windows 7 64-bit it searches for the files in "C:\Program Files" instead of "C:\Program Files (X86)".

Currently we use the following code:

!define common_files "C:\Program Files\Common Files"

!insertmacro InstallLib REGDLL SHARED REBOOT_PROTECTED "${common_files}\Microsoft Shared\DAO\dao360.dll" "$COMMONFILES\Microsoft Shared\DAO\dao360.dll" "$COMMONFILES\Microsoft Shared\DAO"
The code should be changed so it works for my 64-bit OS, as well for my colleagues on 32-bit XP.
Is there a way to change the hard coded define 'common_files' to something dynamic?

I tried to use $COMMONFILES but this is not defined during compilation.

Try $%COMMONPROGRAMFILES(x86)%

Stu


Thanks, but COMMONPROGRAMFILES(x86) is an environment variable that I don't think is available on XP. So how to create an easy but universal script for compilation? During Installation there are the convenient NSIS Constants, but I didn't manage to get those working during compilation. Any tips?


did you use > $%COMMONPROGRAMFILES(x86)% < as AfrowUK mentioned?

this will get the compillertime path for the C:\Program Files (x86)\Common Files on 64bit OS and C:\Program Files\Common Files on 32bit OS


Sorry for the delay, but I had to find a machine with XP installed. I resorted to running XP in a virtual machine.

I was correct in assuming that > $%COMMONPROGRAMFILES(x86)% < doesn't work on 32-bit XP, it is an undefined variable on that platform.
What does work is the Environment variable > $%COMMONPROGRAMFILES% <. This will give me the desired effect for the compillertime path to C:\Program Files (x86)\Common Files on 64bit OS and C:\Program Files\Common Files on 32bit OS

I still don't like it that Compile-time I have to resort to other methods for determining the Environment than during Run-time. An orthogonal command set would make it easier to learn programming NSIS and has the potential of reducing the NSIS code base.