Program Files direcory localisation

Got a problem you cannot solve? Try here.
Ton_B
Posts: 115
Joined: Wed Nov 16, 2005 8:34 am
Location: Netherlands
Contact:

Program Files direcory localisation

Postby Ton_B » Tue Mar 11, 2014 9:33 am

I've created a generic setup which can be started with a command line.
This command line contacins the setup location lik "Program files"

Inside my script i detect if the current OS is 32 or 64 bits and alter the location to "Program Files(x86)" if the system is 64 bits.

But because in some countries this path do not have "program files" I would like to get the default "program files" directory name oth the current county.

See:
http://en.wikipedia.org/wiki/Program_Files

in .NET you can retreive it with this code: http://stackoverflow.com/questions/194157/c-sharp-how-to-get-program-files-x86-on-windows-vista-64-bit
in vb6 you can make an api call like this : http://www.developerfusion.com/code/251/special-folder-paths/

The question is, does IA has a similar function? or do i have to make a api call?
Ton Blokhuizen
Tooling Engineer
BMA BV - Netherlands
[i]BMA: leading the way in obstetrical data management
http://www.bma-mosos.nl[/i]

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Program Files direcory localisation

Postby FrancescoT » Tue Mar 11, 2014 1:23 pm

Dear Ton,

The IA command "Get Folder Location" does exactly when used to acquire the "System->Program Files".

If you need to dected the target Program Files directory based on the target OS platform, just call the "Get Folder Location" after a Set x64 statement.

Example;

Code: Select all

Set Variable ISWIN64 to FALSE
Get System Setting Windows in 64 bit Mode into ISWIN64
if Variable ISWIN64 Equals TRUE
  Comment: SWITCH TO NATIVE 64 BIT MODE
  Set x64 - Native 64 bit Windows, AMD64 and EM64T Architectures - installation mode
end
 
Get Folder Location System->Program Files Directory into PROGRAMFILES
 
if Variable ISWIN64 Equals TRUE
  Comment: SWITCH BACK TO NATIVE 32 BIT MODE ... IF YOU ARE INSTALLING A NATIVE 32 BIT APP!
  Set Win32 - Native 32 bit Windows and Windows 32 on Windows 64 (WOW64) - installation mode
end


Hope this helps you.

Regards
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE

Ton_B
Posts: 115
Joined: Wed Nov 16, 2005 8:34 am
Location: Netherlands
Contact:

Re: Program Files direcory localisation

Postby Ton_B » Thu Mar 13, 2014 1:15 am

Hello Francesco.

Yhank you very much!
Your sample code is exactly what I need, including the "swich back to 32 bit" !
Ton Blokhuizen
Tooling Engineer
BMA BV - Netherlands
[i]BMA: leading the way in obstetrical data management
http://www.bma-mosos.nl[/i]

FrancescoT
Site Admin
Posts: 5361
Joined: Sun Aug 22, 2010 4:28 am

Re: Program Files direcory localisation

Postby FrancescoT » Thu Mar 13, 2014 9:16 am

:D
Francesco Toscano
InstallAware Software

White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE


Return to “Technical Support”

Who is online

Users browsing this forum: JohnGaver and 90 guests