diff options
author | Jake Petroules <jake.petroules@petroules.com> | 2014-04-07 17:05:11 -0400 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@digia.com> | 2014-04-15 18:44:34 +0200 |
commit | b2056926cb31d656c83a849abd28fe6132916a24 (patch) | |
tree | 6b33b585229b97dc0b01eefc52b9a422986ba63c /share | |
parent | 03e39d7d2c2a44833df39d428466d329f8741ae9 (diff) |
Declare EnvironmentVariable class according to standard conventions.
Change-Id: Ib8e8da8d56aa6d7f17d7e2ec138a518219febb9a
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/imports/qbs/ModUtils/utils.js | 61 |
1 files changed, 28 insertions, 33 deletions
diff --git a/share/qbs/imports/qbs/ModUtils/utils.js b/share/qbs/imports/qbs/ModUtils/utils.js index 1662e0292..506ee6354 100644 --- a/share/qbs/imports/qbs/ModUtils/utils.js +++ b/share/qbs/imports/qbs/ModUtils/utils.js @@ -124,38 +124,33 @@ function dumpObject(obj, description) { traverseObject(obj, dumpProperty); } -////////////////////////////////////////////////////////// -// The EnvironmentVariable class -// -function EnvironmentVariable(name, separator, convertPathSeparators) -{ - if (!name) - throw "EnvironmentVariable c'tor needs a name as first argument."; - this.name = name; - this.value = getEnv(name).toString(); - this.separator = separator || ""; - this.convertPathSeparators = convertPathSeparators || false; -} - -EnvironmentVariable.prototype.prepend = function(v) -{ - if (this.value.length > 0 && this.value.charAt(0) !== this.separator) - this.value = this.separator + this.value; - if (this.convertPathSeparators) - v = FileInfo.toWindowsSeparators(v); - this.value = v + this.value; -} +var EnvironmentVariable = (function () { + function EnvironmentVariable(name, separator, convertPathSeparators) { + if (!name) + throw "EnvironmentVariable c'tor needs a name as first argument."; + this.name = name; + this.value = getEnv(name).toString(); + this.separator = separator || ""; + this.convertPathSeparators = convertPathSeparators || false; + } + EnvironmentVariable.prototype.prepend = function (v) { + if (this.value.length > 0 && this.value.charAt(0) !== this.separator) + this.value = this.separator + this.value; + if (this.convertPathSeparators) + v = FileInfo.toWindowsSeparators(v); + this.value = v + this.value; + }; -EnvironmentVariable.prototype.append = function(v) -{ - if (this.value.length > 0) - this.value += this.separator; - if (this.convertPathSeparators) - v = FileInfo.toWindowsSeparators(v); - this.value += v; -} + EnvironmentVariable.prototype.append = function (v) { + if (this.value.length > 0) + this.value += this.separator; + if (this.convertPathSeparators) + v = FileInfo.toWindowsSeparators(v); + this.value += v; + }; -EnvironmentVariable.prototype.set = function() -{ - putEnv(this.name, this.value); -} + EnvironmentVariable.prototype.set = function () { + putEnv(this.name, this.value); + }; + return EnvironmentVariable; +})(); |