0

I'm fighting with Qt Installer Framework for creating a shortcut for my application into start menu in Windows Platform. I used the same script as into startmenu example, but it throws an error during the creation of the shortcut. I don't understand the reason it looks there is a problem with path in my code:

Component.prototype.createOperations = function()
{
    // call default implementation to actually install README.txt!
    component.createOperations();
    if (systemInfo.productType === "windows") {
        component.addOperation("CreateShortcut", "@TargetDir@/EurocontrolGui.exe", "@StartMenuDir@/EurocontrolGui.lnk",
            "workingDirectory=@TargetDir@", "iconPath=@TargetDir@/resources/eurocontrol.ico", "description=Eurocontrol Developer Tool");
    }
}

Below there is my config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Installer>
    <Name>Eurocontrol Developer Tool</Name>
    <Version>0.11.0</Version>
    <Title>Eurocontrol Developer Tool </Title>
    <Publisher>Honeywell Inc.</Publisher>
    <StartMenuDir>Eurocontrol Developer Tool</StartMenuDir>
    <TargetDir>@ApplicationsDirX86@/Eurocontrol Developer Tool</TargetDir>
    <InstallActionColumnVisible>true</InstallActionColumnVisible>
</Installer>

I run also the Installer changing from @TargetDir@/EurocontrolGui.exe, to @TargetDir@\EurocontrolGui.exe, (the same for StartMenuDir). In this case no error was thrown and the shortcut was created although the reference was invalid.

In this case when I run Installer.exe -v from command line, I'm able to see that the path for my application is changed from

C:\Program Files(x86)\Eurocontrol Developer Tool/EurocontrolGui.exe 

to

C:\Program Files(x86)\Eurocontrol Developer ToolEurocontrolGui.exe

It looks that the path are malformed during the add Operation.

Any idea how to solve it?

Alper Kucukkomurler
  • 1,706
  • 2
  • 13
  • 19

1 Answers1

0

I'd be surprised if QtInstaller gave trouble over forward slashes, but if you want to use backslashes, I believe you have to escape them first, so instead of @TargetDir@\EurocontrolGui.exe, it should be @TargetDir@\\EurocontrolGui.exe

Below is what I'm using, which works fine. Note that I actually forgot to replace one of the '/' with '\\', but it still works.

Component.prototype.createOperations = function()
{
    component.createOperations();
    if (systemInfo.productType === "windows") {
        component.addOperation("CreateShortcut", "@TargetDir@\\app.exe", "@StartMenuDir@/app.lnk","iconPath=@TargetDir@\\icon.ico");
    }
}
jalani
  • 53
  • 1
  • 7