Uploaded image for project: 'Qt Installer Framework'
  1. Qt Installer Framework
  2. QTIFW-3871

CreateShortcut Operation ignores optional arguments in Windows shortcuts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 4.10
    • General
    • None
    • Windows

      Description:
      When creating a shortcut via CreateShortcut Operation, optional arguments intended for the target executable are ignored even when the shortcut path is not @AllUsersStartMenuProgramsPath@.

      Steps to Reproduce:

      1. Define a CreateShortcut operation in component.xml or add it via script: 
        <Operation name="CreateShortcut">
         <Argument>@TargetDir@/MyMaintenance.exe</Argument>
         <Argument>@TargetDir@/Uninstall.lnk</Argument>
         <Argument>--start-uninstaller</Argument>
         <Argument>workingDirectory=@TargetDir@</Argument>
         <Argument>iconPath=@TargetDir@/MyMaintenance.exe</Argument>
         <Argument>iconId=0</Argument>
        </Operation>
        <Operation name="SimpleMoveFile">
         <Argument>@TargetDir@/Uninstall.lnk</Argument>
         <Argument>@StartMenuDir@/Uninstall.lnk</Argument>
        </Operation>
        

        or via component script:

        component.addOperation("CreateShortcut",
                               "@TargetDir@\\MyMaintenance.exe",
                               "@TargetDir@\\Uninstall.lnk",
                               "--start-uninstaller",
                               "workingDirectory=@TargetDir@",
                               "iconPath=@TargetDir@\\MyMaintenance.exe",
                               "iconId=0");
        component.addOperation("SimpleMoveFile",
                               "@TargetDir@\\LBMaintenance.lnk",
                               "@StartMenuDir@\\LBMaintenance.lnk");
        
      2. Run the installer on Windows.
      3. Inspect the created .lnk file.

      Expected Behavior:
      The shortcut should point to @TargetDir@\MyMaintenance.exe and pass --start-uninstaller as a command-line argument.

      Actual Behavior:
      The shortcut target does not include --start-uninstaller ; the target is simply "@TargetDir@\MyMaintenance.exe and the argument is ignored entirely. Only the executable path is used.

      Notes:

      • Single arguments like "workingDirectory=..." and "iconPath=..." work correctly.
      • The workaround suggested in Operations (If the @AllUsersStartMenuProgramsPath@ is used for placing the shortcut, then due to a problem on Windows, it will drop any arguments to the target and any description set. In this case, you should place the shortcut elsewhere and copy it to the location desired.) does not work.
      • Multiple or standard command-line arguments are not passed to the shortcut.
      • Workarounds such as quoting the arguments ("--start-uninstaller") or combining them in the first argument do not work.
      • Code inspection (shortcutoperation.cpp) shows that createLink() on Windows calls psl->SetArguments(arguments) so that, in principle, the addition of target arguments should work.

      Alternatives step to reproduce:

      1. Install Qt 6.9.2 + QtIFW 4.10
      2. Clone https://github.com/flinco/LBChronoRace
      3. Check out the develop branch
      4. Build the target launcher
      5. Install using the built installer
      6. Verify that the LBUninstall and LBMaintenance Strat Menu links do not contain the expected {}start-uninstaller{-} and -start-updater argument.

      Furthermore:
      The Use column of the CreateShortcut operation described by Operations states:
      Creates a shortcut from the file specified by filename to linkname.
      but I think the correct text should be
      Creates a shortcut from the file specified by linkname to filename.

        1. package.xml
          6 kB
        2. installscript.qs
          4 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            installerteam Installer Team
            flinco Lorenzo Buzzi
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes