Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   Problem with path when building on Windows 7, 64 bit (http://forums.winamp.com/showthread.php?t=332569)

indy31 18th July 2011 09:37

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:
Quote:

!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.

Afrow UK 18th July 2011 11:13

Try $%COMMONPROGRAMFILES(x86)%

Stu

indy31 21st July 2011 19:37

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?

Smurge 21st July 2011 20:18

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

indy31 26th July 2011 15:34

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.


All times are GMT. The time now is 17:40.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.