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

File association broken under Windows

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.7
    • Scripting
    • None
    • Windows 11 23H2
    • Windows

      File association does not work under Windows.

      The command in the registry in Computer\HKEY_CLASSES_ROOT\Applications\Company.MyApp.ext\shell\Open\Command is: 

      C:/Program Files/Company/MyApp/myapp.exe "%1"

       instead of:

      C:\Program Files\Company\MyApp\myapp.exe "%1"

      The forward slashes are invalid, this makes it unable to run, so double-clicking on a file of type ".ext" generates an error and does not open the application.

      My installscript.qs is the following:

      function Component()
      {
      }
       
      Component.prototype.createOperations = function()
      {
          component.createOperations();
          if (systemInfo.productType === "windows")
          {
              component.addOperation("RegisterFileType","ext","@TargetDir@/myapp.exe \"%1\"","MyApp files","application/octet-stream",  "@TargetDir@/myapp.exe,1","ProgId=Company.MyApp.ext");
          }
      }
      

       
      Editing the registry to fix the path with backslashes seem to fix this issue.
      I've seen that there exists a function installer.toNativeSeparators(), but I don't understand how to use it here.

      I've tried with backslashese in the script, but only the last folder changes.

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            installerteam Installer Team
            a.habersaat Alexandre Habersaat
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes