InnoSetup tries to Create DefaultDir in any case - inno-setup

I created an installer with innosetup to install an application that consists of two executables. Each of them should go to a separate folder. So I created a custom InputDirPage using the "CreateInputDirPage" function and added two entries to this page, one for each executable
To prevent the default DirPage from showing up I used these parameters in the [Setup} section:
DisableDirPage = yes AND AlwaysShowDirOnReadyPage= no
I wrote functions to extract the Folder paths from my custom DirPage and
this works fine and evrything ends up where it is supposed to be.
BUT: During the installation process Innosetup tries to create the folder set in the DefaultDirName as this folder is the value in the invisible DirPage.
If that folder does not exists and one would need administrator rights to create that folder, the setup will crash.
I worked around that problem by setting DefaultDirName = {pf} in the [Setup] section.
(As the program folder does always exist, I do not get any error messsage for failed creation attempts that way)
Now my questions are these:
Is there a setup parameter that tells Innosetup to completely ignore
the content of the wizard dir page? Because making it invisble seems
no to be sufficient.
Can I set that content or the {app} constant at runtime to avoid the "DefaultDirName" folder from being created?

Yes, there is an option called CreateAppDir.
[Setup]
CreateAppDir=No

Related

how to "save" a file/folder in the Node.js app "Universal GUI"

I can't figure out how to add a "save file/folder" input to Universal GUI.
I need to be able to pick a location to pass as a file or folder
to the cli program without the file/folder in question existing already.
Selecting a pre-existing file to pass to the cli command is easy, just use the generic file upload entry.
And Universal GUI already has a "select folder" entry.
Both options require selecting one that already exists.
So all I need is to be able to select a file and/or folder that doesn't exist in a "save" form.
I've never found an alternative to NW.js that doesn't require manually setting up the Node.js launcher.
So that's what I run the app I made in/for Universal GUI.
The folder browser is designed to allow you to select existing folders or create new ones. File select will also allow you to create new files.
It sounds like what you want is to use the folder selector, so the user can select the folder (or create it, then select it) as their output directory. Then give them an input text field to type a file name into. Then you just combine all of that together as an argument for the CLI.
<cmd executable="myexe">
<arg>--save "((outputDirectory))\((fileName)).txt"</arg>
</cmd>
<!--
What would be sent to the command line:
myexe --save "C:\Users\Bob\Desktop\SomeFolder\MyFile.txt"
-->

Inno Setup define the {tmp} location

I need to define the {tmp} constant (i.e. the automatically generated TEMP location), so that it always remains the same and does not change each time it is run. Ideally setting it to the root of the users TEMP directory, rather than the automatically created subdirectory (e.g. is-70G7E.tmp):
C:\Users\Username\AppData\Local\Temp
Instead of:
C:\Users\Username\AppData\Local\Temp\is-XXXXX.tmp
Is this possible and, if so, how could it be done?
To expand on the reason for this, in response to comments below, when using InnoTools Tray, it creates multiple entries in the System Tray Notification Area Icons:
This is because each time it is run, it is run from a different {tmp} folder. If I can set this manually myself to be constant and handle the issues of checking for files in use etc it will resolve this issue.
If there is another way to resolve this, then I am open to suggestions.
It's not possible. The creation of random subdirectory in TEMP is hardcoded. There's no way to change it.
See the CreateTempDir function in Inno Setup source code.
You didn't state why you need it to be constant, but a problem may rise if you use a constant folder. What if the folder or files in it are in use? That's why {tmp} varies, and Inno Setup handles it for you.
However, you can use the {%TEMP} constant or the GetTempDir function instead, with whichever sub-folder you like as a constant. You may need to handle its creation and deletion though.

How do you find the user-selected install path in Inno Setup?

I need to get the path that the user chose to install my application into.
If I set CreateAppDir=yes and set a DefaultDirName=C:\MyApp\ the user can change it to some other directory. After they do this, I need to know which directory they chose on the next install wizard step. How can I get this value?
Use the {app} constant. The reference describes it as:
The application directory, which the user selects on the Select
Destination Location page of the wizard. For example: If you used
{app}\MYPROG.EXE on an entry and the user selected "C:\MYPROG" as the
application directory, Setup will translate it to
"C:\MYPROG\MYPROG.EXE".
Optionally you can use the WizardDirValue function. This one is described as:
Returns the current contents of the edit control on the Select
Destination Location page of the wizard.
Unlike ExpandConstant('{app}'), this function will not fail if called
after the wizard is shown but prior to the user selecting a directory.
Rather, it will return the default directory name.

How to set the install path of a merge module from a registry key?

I have created an installer (using InstallShield 2012 Spring) that consumes a merge module that I created and I want to install the files from both the main installer and the merge module to a path that is stored in the registry. In a separate installer the user is able to specify the install location and I save this path in the registry to be used by subsequent installers.
In the merge module my components have a desination of 'INSTALLDIR\Folder'. In the main installer I have changed the Destination property in the Redistributables pane from '(User merge module's default destination)' to 'INSTALLDIR'. This allows me to install the merge module's files to the same path that is in the main installer when the installer is built, but if I change the Destination during run time (through custom action or the DestinationFolder dialog) only the main installer's files are installed to the desired path.
I am using an system search to retrieve the path from the registry and store it in a property. Then I have a custom action that sets INSTALLDIR to the path that is read from the registry.
If I go to the direct editor of the merge module and edit the Directory table I can change INSTALLDIR.GUID to INSTALLDIR and I get my desired results however this causes the 'Components' and 'Files and Folders' panes to be unusable.
Is there a better way to do this?
I saw these answers and they got me started but I can't seem to get the Merge Module's destination to change during run time.
Installshield 12: Changing the destination of a merge module at run time
Make installshield merge module installation path configurable for user
I ran into a similar situation. If you remove the GUID from the INSTALLDIR values only in the Directory_Parent column, then the Files and Folders, etc, panels become unusable. You need to be sure that you remove the GUID from the INSTALLDIR cell in the Directory column as well. Then the merge module will 'inherit' the INSTALLDIR of the parent installer and the directories you've created in your merge module will inherit from that.

how to add directory to SupportFiles in InstallShield

Is there a possibility to add directory (with sub directories) to SupportFiles section in installshield. I have dynamically created content (list of files changes constantly) that I use to support my installation.
Is there any other method to add dynamically whole directory to installation package. I need files from this directory only during installation process. At the end of the installation I want IS to remove these files automatically ?
The ISSetupFile table ( which drives the Support Files pattern ) only supports extracting files to a single directory. There is no way in the UI to tell it to be dynamic although you could have a build automation step that reflects the contents of a directory and wires it up to the table using the automation interface. This still couldn't do sub directories though.
What you probably want to do is creating a self-extracting zip of the files you need as part of your build and add that EXE to Support Files. Then write custom actions that call the EXE to extract the payload to Support Files and another CA to clean it up. Look for the custom action ISSetupFilesExtract and ISSetupFilesCleanup to figure out the best way to do this.
Although I'm late to the party: #BuvinJ mentioned in a comment that you can add directories to "Advanced Files" under "Disk1." In this case, they do appear in the temporary directory (support directory), eg. SUPPORTDIR\Disk1
SUPPORTDIR is a temporary location where the installer dumps files, and cleans them up afterward. An example is C:\Users\<your user name>\AppData\Local\Temp\2\{F6B9B2D6-2A5A-4146-9297-E80A199CB0CB}.
This could be a quicker/cheaper/faster solution to writing custom actions and/or packaging up files by hand in, say, a self-extracting zip file.

Resources