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

RegisterFileType no longer works on Windows following examples

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: P2: Important P2: Important
    • None
    • 4.2.0
    • Scripting
    • Windows 11 Pro 64-bits 21H2 22000.556
    • Windows
    • 70081ce03 (master)
    • Qt Installer Sprint 83

      After updated to QtIFW 4.2 (from version 3), the RegisterFileType operation does not work anymore on Windows 11.

      It is likely due to the TargetDir variable that has changed to have only forward slashes in the path, while Windows seem to require backwards slashes in these path in the Registry, otherwise its fails to execute the associated software with an "Access denied" error.

      After modifying my script with the following to translate into backward slashes, it works again:

       

      var Dir = new function () {
          this.toNativeSparator = function (path) {
              if (systemInfo.productType === "windows")
                  return path.replace(/\//g, '\\');
              return path;
          }
      };
      
      Component.prototype.createOperations = function()
      {
          component.createOperations();
          if (installer.value("os") === "win") {
              // Register file association
              var iconId = 0;
              var exePathNative = '"' + Dir.toNativeSparator(installer.value("TargetDir")) + "\\MyExecutable.exe" + '"';
              component.addOperation("RegisterFileType",
                                     component.unusualFileType,
                                     exePathNative + "\"%1\"",
                                     "MyExecutable file",
                                     "text/plain",
                                     exePathNative + "," + iconId,
                                     "ProgId=MyCompany.MyExecutable." + component.unusualFileType);     
          }
      }
      
      

       

        For Gerrit Dashboard: QTIFW-2578
        # Subject Branch Project Status CR V

            kamartti Katja Marttila
            a.habersaat Alexandre Habersaat
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes