问题
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