Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt安装程序框架:TypeError无法读取属性名称_Qt_Qt5_Qt Installer_Qtscript - Fatal编程技术网

Qt安装程序框架:TypeError无法读取属性名称

Qt安装程序框架:TypeError无法读取属性名称,qt,qt5,qt-installer,qtscript,Qt,Qt5,Qt Installer,Qtscript,我试着按照教程创建一个安装程序。然后,根据Qt安装程序框架目录中的startmenu示例,我添加了一个名为“installerscript.qs”的脚本 “installscript.qs”如下所示: /**************************************************************************** ** ** ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ ** ** ** open-editor to use. *

我试着按照教程创建一个安装程序。然后,根据Qt安装程序框架目录中的startmenu示例,我添加了一个名为“installerscript.qs”的脚本

“installscript.qs”如下所示:

/****************************************************************************
**
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 
**
**  open-editor to use.
**  Copyright (C) 2018  os_sys-devlopment-group
**
**  This program is free software: you can redistribute it and/or modify
**  it under the terms of the GNU General Public License as published by
**  the Free Software Foundation, either version 3 of the License, or
**  (at your option) any later version.
**  This program is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
**  GNU General Public License for more details.
**
**  You should have received a copy of the GNU General Public License
**  along with this program.  If not, see <https://www.gnu.org/licenses/>.
** view the full license at https://www.stranica.nl/open-editor/license.txt
**
** $QT_END_LICENSE$
**
****************************************************************************/

function Component()
{
    // default constructor
}

Component.prototype.createOperations = function()
{

    component.createOperations();


    if (systemInfo.productType === "windows") {
        component.addOperation("CreateShortcut", "@TargetDir@/customtexteditor.exe", "@StartMenuDir@/open-editor.lnk",
            "workingDirectory=@TargetDir@","iconPath=%TargetDir%/Logo.ico");
        component.addOperation("CreateDesktopShortcut", "@TargetDir@/customtexteditor.exe", "@DesktopDir@/open-editor.lnk", 
            "workingDirectory=@TargetDir@", "iconPath=%TargetDir%/Logo.ico",);
    }
    
}
当我在example目录中尝试这个示例时,它起了作用。但是,当我稍微修改它以使用自己的代码时,会出现上述错误

你知道为什么它不起作用吗

我对二进制创建者使用以下命令:

..\..\bin\binarycreator.exe --online-only -c config\config.xml -p packages installer.exe
您可以按照以下链接查看整个项目:您可以找到我的项目的所有文件

口述中的zip文件包含整个包

我改变了我的整个软件包,所以现在所有的东西看起来都有点不同,但都是一样的


正如另一条评论所指出的,路径是重要的

老实说,QtInstallerFramework没有很好的文档,我通过反复试验发现了很多这方面的问题

这绝不是唯一的办法。希望这有助于作为一个例子。还值得注意的是,这将在Linux/OSX上运行,但有一些细微的变化

目录树:

rootdir
    installer
        config
            config.xml   <#1 below>
        packages
        com.<vendor>.installer
            meta
                package.xml  <#2 below>
        com.<vendor>.<name>  [This can be 1-N of these]
            meta
                installscript.qs  <#3 below>
                package.xml       <#4 below>
            data
                <name>
                    <executable and dependencies here>
package.xml#4:


我想我已经找到了解决办法

打开编辑器
因为包名称错误 他们想要这样的东西:

org…安装程序

因此,如果您将
openeditor
重命名为
org.devgroup.open_editor.installer
,您将获得一个在线和离线安装程序

编辑:


至少在windows上是这样的

对不起,这是文件名为installscript.qs的问题中的一个输入错误。我能用它制作一个在线安装程序吗?因为关键是我想制作一个在线安装程序,在示例中他们使用在线安装程序。我假设这就是您一直在遵循的示例?您最初的帖子没有包括在线/离线部分,也就是说差异最小,您也使用repogen工具来实现这一点,正如您在修订后的帖子中指出的,传递--online only vs offline only,我们可以看到更多关于如何设置的信息,尤其是
binarycreator
命令行?从你发布的内容来看,我看不出任何问题。但是我想知道它从哪里得到路径
com.mycompany.program
。IIRC使用
-p
选项设置包路径,并使用
-l
选项设置该文件夹内的可选包列表。您是使用绝对路径还是相对路径来指定不同的位置?(不确定这是否重要,但可能。)请参阅二进制创建者的编辑command@MaximPaperno ^^
..\..\bin\binarycreator.exe --online-only -c config\config.xml -p packages installer.exe
rootdir
    installer
        config
            config.xml   <#1 below>
        packages
        com.<vendor>.installer
            meta
                package.xml  <#2 below>
        com.<vendor>.<name>  [This can be 1-N of these]
            meta
                installscript.qs  <#3 below>
                package.xml       <#4 below>
            data
                <name>
                    <executable and dependencies here>
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
    <Name>[Name]</Name>
    <Version>[Version]</Version>
    <Title>[Application Title]</Title>
    <Publisher>[Publisher]</Publisher>
    <StartMenuDir>[VendorName]/[Name] [Version]</StartMenuDir>
    <TargetDir>@ApplicationsDir@/[Publisher]/[Name] @Version@</TargetDir>
    <ProductUrl>[yoururlhere.com]</ProductUrl>
</Installer>
<?xml version="1.0" encoding="UTF-8"?>
<Package>
    <DisplayName>Installer</DisplayName>
    <Description>[Publisher] Software Installer</Description>
    <Version>[1.0.0]</Version>
    <ReleaseDate>[2019-11-13]</ReleaseDate>
    <Name>com.[Vendor].installer</Name>
    <Virtual>true</Virtual>
    <UpdateText>This changed compared to the last release</UpdateText>
</Package>
function Component()
{
    // default constructor
}

Component.prototype.createOperations = function()
{
    // This actually installs the files
    component.createOperations();

    if (systemInfo.productType == "windows") {
        // Start menu shortcut
        component.addOperation("CreateShortcut", 
                               "@TargetDir@/[Name]/[Executable.exe]", 
                               "@StartMenuDir@/[Name].lnk", 
                               "workingDirectory=@TargetDir@/[Name]", 
                               "iconPath=@TargetDir@/[Name]/[Name].ico");

       // Desktop Shortcut
       component.addOperation("CreateShortcut", 
                              "@TargetDir@/[Name]/[Executable.exe]",
                              "@DesktopDir@/[Name] @Version@.lnk",
                              "workingDirectory=@TargetDir@/[Name]", 
                              "iconPath=@TargetDir@/[Name]/[Name].ico");
    }
}
<?xml version="1.0" encoding="UTF-8"?>
<Package>
    <DisplayName>[Name]</DisplayName>
    <Description>[Some description]</Description>
    <Version>[Version]</Version>
    <ReleaseDate>[Date]</ReleaseDate>
    <Name>com.[vendor].[name]</Name>
    <Script>installscript.qs</Script>
    <Default>false</Default>
    <ForcedInstallation>true</ForcedInstallation>
</Package>
binarycreator.exe --offline-only -c "installer/config/config.xml" -p "installer/packages" "$[Name]Installer_[version].exe"