Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
4.2.0
-
Windows 11 Pro 64-bits 21H2 22000.556
Description
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); } }