Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 841
Rustem Avatar asked Sep 27 '13 12:09

Rustem


2 Answers

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

like image 198
eatyourgreens Avatar answered Oct 12 '22 19:10

eatyourgreens


You need this based on the documentation:

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

like image 35
lpapp Avatar answered Oct 12 '22 21:10

lpapp