Download file based on IF condition?

Answered

Comments

1 comment

  • Avatar
    juanjo

    You could use the below code:

    <httpGet>
        <filename>${system_temp_directory}/version.txt</filename>
        <url>http://example.com/version.txt</url>
    </httpGet>
    <readFile>
        <name>file_version</name>
        <path>${system_temp_directory}/version.txt</path>
    </readFile>
    <setInstallerVariableFromRegEx>
        <name>file_version</name>
        <pattern>(^[^\n]+).*</pattern>
        <substitution>\1</substitution>
        <text>${file_version}</text>
    </setInstallerVariableFromRegEx>
    <httpGet>
        <filename>${system_temp_directory}/file-to-download</filename>
        <url>http://example.com/file-to-download</url>
        <ruleList>
            <compareVersions>
                <logic>greater</logic>
                <version1>${file_version}</version1>
                <version2>${project.version}</version2>
            </compareVersions>
        </ruleList>
    </httpGet>
    

Please sign in to leave a comment.