1

How can I add a new Environment Variable to the Qt installer. I know that it should go in the .qs script something like the following:

var path = installer.environmentVariable("PATH") + ";" + installer.value("TargetDir");
component.addElevatedOperation("EnvironmentVariable","PATH",path,true);

I'm trying the above on Linux, but it's complaining about EnvironmentVariable not existing when I install my program.

bardao
  • 914
  • 12
  • 23
  • 1
    As specified in the [Documentation](https://doc.qt.io/qtinstallerframework/operations.html#summary-of-operations), this is currently only supported on windows. You will have perform that step manually on linux. See https://stackoverflow.com/a/26962251/3767076 to get started – Felix Jan 03 '19 at 10:43

1 Answers1

0

Well this operation is only supported on windows, but you can try do this:

component.addElevatedOperation("AppendFile", "/etc/environment", "export PATH=\"$PATH;@TargetDir@\"\n");

Warning: do this only on installation process

if (installer.isInstaller()) {
     [...]
}

If this runs on unistallation, maybe can delete other things of /etc/environment