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

RegisterFileType doesn't work properly when user had made a previous choice

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Installer Framework 4.2
    • Scripting
    • Windows 10
    • Windows

    Description

      Example

      ```
      touch file.idf
      ```

      Right click file.idf, open With > "Notepad.exe" and tick "Always use this app to open .idf files"

      This will populate a registry entry here at `HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.idf\UserChoice`

      ```
      C:\Windows\system32> reg.exe QUERY HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.idf\UserChoice
      ProgId REG_SZ Applications\notepad.exe
      Hash REG_SZ s3i1KTucehE=
      ```

      Create an installer with a QS script that does this

      ```
      var targetDir = installer.value("TargetDir").replace(/\//g, '
      ');
      console.log("RegisterFileType: targetDir=" + targetDir);

      component.addElevatedOperation("RegisterFileType", "idf", `${targetDir}
      EP-Launch.exe %1`, "EnergyPlus Input Data File", "text/plain");
      ```

      The filetype association is not overriden by the installer since the UserChoice one above takes precedence (and is not overwritten). The actual reg entries are created around here: https://github.com/qtproject/installer-framework/blob/0ec58b6586f688c7d46c707c3eedfcc807387c3f/src/libs/installer/registerfiletypeoperation.cpp#L107-L121

      I think the UserChoice needs to be deleted or overwritten in `RegisterFileTypeOperation::performOperation`

      Attachments

        Activity

          People

            installerteam Installer Team
            jmarrec Julien Marrec
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: