문제

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.

도움이 되었습니까?

해결책 2

You need this based on the documentation:

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top