Windows Qt安装程序框架未注册文件类型
我正在尝试使用Qt安装程序框架(windows中的3.1版)创建的安装程序。我用于测试的软件包是一个图像查看器,它可以加载自定义文件格式:.cjpg(基本上与jpg相同,但名称不同)。这个项目可以找到 pacakgeWindows Qt安装程序框架未注册文件类型,windows,qt,file-type,qt-installer,Windows,Qt,File Type,Qt Installer,我正在尝试使用Qt安装程序框架(windows中的3.1版)创建的安装程序。我用于测试的软件包是一个图像查看器,它可以加载自定义文件格式:.cjpg(基本上与jpg相同,但名称不同)。这个项目可以找到 pacakgexml文件包含以下脚本: function Component() { // default constructor } Component.prototype.createOperations = function() { component.createOperatio
xml
文件包含以下脚本:
function Component()
{
// default constructor
}
Component.prototype.createOperations = function()
{
component.createOperations();
if (systemInfo.productType == "windows")
{
component.addOperation("Execute","{0,3010}","@TargetDir@/VC_redist.x64.exe","/quiet","/norestart");
component.addOperation("CreateShortcut",
"@TargetDir@/image_view.exe",
"@StartMenuDir@/image_view.lnk",
"iconPath=@TargetDir@/image_view.ico")
component.addOperation("CreateShortcut",
"@TargetDir@/image_view.exe",
"@DesktopDir@/image_view.lnk",
"iconPath=@TargetDir@/image_view.ico")
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe '%1'",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico")
}
}
此脚本安装VC_redist,因为我使用MSVC编译器进行编译,据我所知,这是必要的。此外,它还创建了桌面和“开始”菜单快捷方式。这三个部分工作得很好。但是,与程序关联的新文件类型(.cjpg)零件不工作(当双击文件时,图标未显示,程序未打开)。我一直遵循这一点。关于文件注册操作,我理解的唯一区别是教程定义了一个图标id和一个ProgId。如果我尝试将该部分更改为:
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe '%1'",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico",
"ProgId=ImageViewer.cjpg")
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe '%1'",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico", 0,
"ProgId=ImageViewer.cjpg")
文件仍然未正确关联(当doble单击文件时,图标未显示,程序未打开)。如果我尝试将该部分更改为:
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe '%1'",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico",
"ProgId=ImageViewer.cjpg")
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe '%1'",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico", 0,
"ProgId=ImageViewer.cjpg")
或:
我在安装过程中遇到以下错误:
Error during installation process (com.vendor.image_view):
Invalid arguments in RegisterFileType: 6 arguments given, 2 to 5 arguments expected in the form: <extension> <command> [description[contentType[icon]]].
安装过程中出错(com.vendor.image\u视图):
RegisterFileType中的参数无效:给定了6个参数,表单:[description[contentType[icon]]中需要2到5个参数。
关于如何将文件扩展名与提供的图标文件和程序正确关联的任何想法?使用如下
component.addOperation("RegisterFileType",
".cjpg",
"@TargetDir@/image_view.exe \"%1\"",
"Custom JPG file extension",
"text/plain",
"@TargetDir@/cjpg_file_icon.ico",
"ProgId=ImageViewer.cjpg")
我添加了“%1”,而不是“%1”