How can I make file association in Qt installer(1.5.0)?

牧云@^-^@ 提交于 2019-12-11 13:19:52

问题


How can I make file association in Qt installer framework(1.5.0) on Windows? I want to do this:

For example, when I double click myFile.x then my qt desktop application(Windows) will launch and open this file.

I want to correct this in installscript.qs :

component.addOperation("CreateShortcut", "@TargetDir@/A.exe", "@StartMenuDir@/A.lnk");
component.addOperation("RegisterFileType", 
                       "fl", 
                       "@TargetDir@\\A.exe" + "'%1'", 
                       "myFiles", 
                       "text/plain",
                       "@TargetDir@/A_icon.ico", 
                       "ProgId=A.fl");
component.addOperation("CreateShortcut", "@TargetDir@/uninstall.exe", "@StartMenuDir@/Uninstall.lnk");

When I write this string, it gives parse error. Output is : Caught exception: Exception while loading component script: 'D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs

SyntaxError: Parse error

Backtrace: ()@D:/Workspace/A/A_installer/A/packages/com.ge.mss/meta/installscript.qs:102'


回答1:


If you are using windows just follow this:

component.addOperation("RegisterFileType",
                       "bob",
                       "@TargetDir@\\BobiSoft.exe \" %1\"",
                       "BobiSoft Files",
                       "application/x-binary",
                       "@TargetDir@/bobi_file_icon.ico",
                       "ProgId=BobiSoft.bob"); 

I also had this problem, the trick was to replace the ' %1' as many examples say, with \" %1\".



来源:https://stackoverflow.com/questions/32316361/how-can-i-make-file-association-in-qt-installer1-5-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!