aboutsummaryrefslogtreecommitdiffstats
path: root/qbs-resources/imports/QbsFunctions/functions.js
blob: f7759d0b51a2c572e959bf2cbb195555834346aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function qbsVersion() { return "1.5.2"; }

function versionIsAtLeast(actualVersion, expectedVersion)
{
    var actualVersionParts = actualVersion.split('.').map(function(item) {
        return parseInt(item, 10);
    });
    var expectedVersionParts = expectedVersion.split('.').map(function(item) {
        return parseInt(item, 10);
    });
    for (var i = 0; i < expectedVersionParts.length; ++i) {
        if (actualVersionParts[i] > expectedVersionParts[i])
            return true;
        if (actualVersionParts[i] < expectedVersionParts[i])
            return false;
    }
    return i === expectedVersionParts.length || expectedVersionParts[i] === 0;
}