Old 18th July 2011, 09:37   #1
indy31
Junior Member
 
Join Date: Jul 2011
Posts: 5
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.
indy31 is offline   Reply With Quote
Old 18th July 2011, 11:13   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Try $%COMMONPROGRAMFILES(x86)%

Stu
Afrow UK is offline   Reply With Quote
Old 21st July 2011, 19:37   #3
indy31
Junior Member
 
Join Date: Jul 2011
Posts: 5
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?
indy31 is offline   Reply With Quote
Old 21st July 2011, 20:18   #4
Smurge
Junior Member
 
Join Date: Apr 2008
Posts: 21
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
Smurge is offline   Reply With Quote
Old 26th July 2011, 15:34   #5
indy31
Junior Member
 
Join Date: Jul 2011
Posts: 5
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.
indy31 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump