我正在与Qt Installer Framework进行斗争,以便为Windows平台的“开始”菜单中的应用程序创建快捷方式。 我在开始菜单示例中使用了相同的脚本,但是在创建快捷方式时会引发错误。我不明白看起来代码存在路径问题的原因:
Component.prototype.createOperations = function()
{
// call default implementation to actually install README.txt!
component.createOperations();
if (systemInfo.productType === "windows") {
component.addOperation("CreateShortcut", "@TargetDir@/EurocontrolGui.exe", "@StartMenuDir@/EurocontrolGui.lnk",
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@/resources/eurocontrol.ico", "description=Eurocontrol Developer Tool");
}
}
下面是我的config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>Eurocontrol Developer Tool</Name>
<Version>0.11.0</Version>
<Title>Eurocontrol Developer Tool </Title>
<Publisher>Honeywell Inc.</Publisher>
<StartMenuDir>Eurocontrol Developer Tool</StartMenuDir>
<TargetDir>@ApplicationsDirX86@/Eurocontrol Developer Tool</TargetDir>
<InstallActionColumnVisible>true</InstallActionColumnVisible>
</Installer>
我还运行了安装程序,从@TargetDir@/EurocontrolGui.exe
更改为@TargetDir@\EurocontrolGui.exe
(与StartMenuDir
相同)。在这种情况下,尽管引用无效,但不会引发任何错误,并且创建了快捷方式。
在这种情况下,当我从命令行运行Installer.exe -v时,我可以看到应用程序的路径已从
更改。C:\Program Files(x86)\Eurocontrol Developer Tool/EurocontrolGui.exe
到
C:\Program Files(x86)\Eurocontrol Developer ToolEurocontrolGui.exe
在添加操作期间,路径似乎格式错误。
有什么办法解决吗?
答案 0 :(得分:0)
如果QtInstaller在正斜杠上遇到麻烦,我会感到惊讶,但是如果您想使用反斜杠,我相信您必须先将其转义,因此,代替-BICs
,它应该是@TargetDir@\EurocontrolGui.exe
下面是我正在使用的东西,它工作正常。请注意,我实际上忘记了用'\\'替换'/'之一,但是它仍然有效。
@TargetDir@\\EurocontrolGui.exe