Randem Systems Support Board

Inno Setup => Inno Setup - General Questions => Topic started by: puffadder on February 11, 2010, 06:32:31 AM

Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 06:32:31 AM
How would I set the default installation directory that the user is prompted for to be {commonappdata}myappname for Windows Vista and Windows 7 but set it to c:program filesmyappname for all other (earlier) OS's ?
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 06:38:12 AM
The default installation for Windows 7 and Vista can be set by adding the template named Legacy. It will automatically determine if you are running Vista / Windows 7 or the prior OS's and set the default installation folder accordingly. The {commonappdata} is not the default installation folder though. If you want to change the installation folder manually you can go to Settings->Parameters from the top menu list to change the DefaultDirName parameter to what you want it to be.
Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 06:44:34 AM
I am not sure how to add a template. I am using innosetup 5.3.7 and istool 5.3.1.
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 06:47:14 AM
Sorry, That was for InnoScript... In Inno Setup just add/change the directive DefaultDirName={commonappdata}\{YOURAPPNAME} in the [Setup] section to change the default installation folder name.
Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 06:52:09 AM
Currently I have ....
 
DefaultDirName={commonappdata}{#MyAppName}
 
This is a hard-coded constant I thought. So if I install to XP for example, it will not install to c:program files.
 
Not sure I am following what you want me to do.
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 06:59:27 AM
In Inno Setup you would need to write code to accomplish the task of changing the DefaultDirName depending on the OS. In InnoScript this has been done for you and all you would need to do is to add the legacy template. Are you familiar with writing code for Inno Setup?
Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 07:03:03 AM
okey dokey then. I just purchased innoscript. I am all for not reinventing the wheel. Can you expedite the purchase and send me the registration code sooner rather than later? Thanks.
Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 07:05:56 AM
Since I have innosetup and istool already installed is there anything special I have to do before I install innoscript?
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 07:07:40 AM
No, there is nothing special to install InnoScript.
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 07:21:18 AM
Also {commonappdata} should not be the default installation folder.  
 
BTW: Has your application been updated for a Limited User Account? You cannot have read-write files in the default {systemdrive}Program Files folder.
Title: Set default install directory based on OS
Post by: puffadder on February 11, 2010, 07:26:01 AM
Yes I know. I did think that the commonappdata folder was a good place to install legacy apps that need to write to the application directory? I have a vb6 app that uses an Access 2000 database. I also write to a local ini file and create log files in the application directory. Where would you suggest I install the app if not in the commonappdata folder?
Title: Set default install directory based on OS
Post by: Randem on February 11, 2010, 07:34:55 AM
The legacy template will take care of that. You should install legacy applications in the \Users\Public\YOURCOMPANYNAME\YOURAPPNAME\ folder