Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt installer framework: installer have problem create License folder during the installation



  • My package.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <Package>
        <DisplayName>DisplayName</DisplayName>
        <Description>Install the application.</Description>
        <Version>version</Version>
        <ReleaseDate>build_date</ReleaseDate>
        <Name>product name</Name>
        <Licenses>
            <License name="License Agreement" file="license.htm" />
        </Licenses>
        <Default>true</Default>
        <Script>installscript.qs</Script>
        <UserInterfaces>
                <UserInterface>aGUI.ui</UserInterface>
        </UserInterfaces>
    </Package>
    

    When I tried to install the program with the installer, all other files and folders are created successfully.
    Except the license file,
    I got the error message window pop up and said:

    Error during installation process. Can not write license file "C:\Program Files\<default installation folder>Licenses\license.html
    

    I have gain admin right with installer.gainAdminRights() and have checked it return true.

    I did a bit testing and found if the <default installation folder> is created beforehand then this issue wont happen.
    But if the <default installation folder> is created by the installer which is how it suppose to be, the error happen.

    I assume that this have something to do with the admin right? but I should have gained it and there is no problem for creating other files and folders.
    Have anyone encounter this before?
    Thank you for the comment and time



  • I found solution for this later.
    By adding

    <RequiresAdminRights>true</RequiresAdminRights>
    

    into package.xml
    and using

    component.addElevatedOperation("License");
    

    in the installscript.qs

    so the installer gain admin right for real.

    I was using installer.gainAdminRights() in the installscript.qs, but it did not really gain the admin right,
    so the error pop up during the installation.

    The other thing I can add is that if you have both adding the tag and the installer.gainAdminRights() in the script it will give a not enough memory error during the installation.


Log in to reply