Rustem
Rustem

Reputation: 326

Qt Installer framework component installation location

I've created an installer package based on the Qt installer framework with multiple components. I needed to install each component in the appropriate directory.

Is it possible to specify the target directory for the individual component? I am referring to something like this:

var appData = installer.environmentVariable("AppData");
     if (appData != "")
         component.setValue("TargetDir", appData+ "/MyComponent");

Thank you in advance.

Upvotes: 5

Views: 3705

Answers (3)

Allen Kempe
Allen Kempe

Reputation: 73

In my case, the component.addOperation("Extract", ... line resulted in extracting to @TargetDir@.

Instead, use one of the 'Operations> options in the Package.xml file.

Upvotes: 0

eatyourgreens
eatyourgreens

Reputation: 1103

This question has already been answered, but I thought I would add a more detailed answer.

The documentation states that "for each component, you can specify one script that prepares the operations to be performed by the installer."

The Qt installer framework QtIFW comes with a set of examples, one of which is called modifyextract. Using this, I modified my package.xml file to include the line

<Script>installscript.qs</Script>

I then added a file installscript.qs to my package meta directory with the following content

function Component()
{
}

Component.prototype.createOperationsForArchive = function(archive)
{
    // don't use the default operation
    // component.createOperationsForArchive(archive);

    // add an extract operation with a modified path
    component.addOperation("Extract", archive, "@TargetDir@/SubDirectoryName");
}

The files in the package data folder were then installed in the subfolder SubDirectoryName

Upvotes: 12

L&#225;szl&#243; Papp
L&#225;szl&#243; Papp

Reputation: 53173

You need this based on the documentation:

Extract "Extract" archive target directory Extracts archive to target directory.

Upvotes: 1

Related Questions