Search code examples
qtqt5qt-installerqtscript

Qt Installer Framework: TypeError cannot read property name


I tried creating an installer following the tutorial. I then added a script called "installerscript.qs" as per the startmenu example in the Qt Installer Framework directory.

The "installscript.qs" is as follows:

/****************************************************************************
**
**
** $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",);
    }
    
}

My package.xml is as below:

<?xml version="1.0" encoding="UTF-8"?>
<Package>
    <DisplayName>open-editor</DisplayName>
    <Description>open-editor</Description>
    <Version>1.0.2</Version>
    <ReleaseDate>2019-11-10</ReleaseDate>
    <Default>true</Default>
    <Name>open-editor</Name>
    <Licenses>
        <License name="End User License Agreement" file="license.txt" />
    </Licenses>
    <ForcedInstallation>true</ForcedInstallation>
    <Script>installscript.qs</Script>
</Package>

When I execute the installer I get the error message:

Exception while loading component script "D:\system\temp\remoterepo-Q2Q7ZU\open-editor\installscript.qs": TypeError: cannot read property 'name' of null on line number: 1

This example worked when I tried it in the example directory. But gives me the above error when I modify it slightly to work with my own code.

any ideas why it does not work?

i use this command for binary creator:

..\..\bin\binarycreator.exe --online-only -c config\config.xml -p packages installer.exe

you can follow the following link to view the whole project: https://ftp.stranica.nl/index/help/project you can find all the files of my project

the zip file in that dictory has the whole package in it

i did changes to my whole packages so now everything looks a bit different but is the same


Solution

  • I think I have found the solution

    open-editor as packages name is wrong they want something like this:

    org.<vendor>.<name>.installer

    so if you rename open-editor to org.devgroup.open_editor.installer you will get a working online and offline installer

    edit:

    at least on windows this is the case