cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [29/51] [abbrv] git commit: Add BOM to files to ensure app pass store certification
Date Wed, 27 Nov 2013 22:27:28 GMT
Add BOM to files to ensure app pass store certification


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/f725bd9e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/f725bd9e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/f725bd9e

Branch: refs/heads/fireos
Commit: f725bd9e1aca7e52ffe72f064f8672986c9ffd9d
Parents: 1edf64a
Author: SomaticIT <contact@somatic.fr>
Authored: Mon Nov 18 20:23:07 2013 +0100
Committer: sgrebnov <sergei.grebnov@gmail.com>
Committed: Mon Nov 25 13:38:20 2013 +0400

----------------------------------------------------------------------
 src/metadata/windows8_parser.js | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f725bd9e/src/metadata/windows8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/windows8_parser.js b/src/metadata/windows8_parser.js
index 7ac7fcb..ea21c92 100644
--- a/src/metadata/windows8_parser.js
+++ b/src/metadata/windows8_parser.js
@@ -276,7 +276,28 @@ module.exports.prototype = {
         //var libDir = path.join(util.libDirectory, 'windows8', 'cordova', require('../../platforms').windows8.version);
         //this.update_www(libDir);
         this.update_staging();
+        this.add_bom();
+
         util.deleteSvnFolders(this.www_dir());
         return Q();
+    },
+
+    // to ensure app pass windows store certification
+    add_bom: function () {
+        var www = this.www_dir();
+        var files = shell.ls('-R', www);
+
+        files.forEach(function (file) {
+            if (!file.match(/\.(js|html|css|json)/)) {
+                return;
+            }
+
+            var filePath = path.join(www, file);
+            var content = fs.readFileSync(filePath);
+
+            if (content[0] !== 0xEF && content[1] !== 0xBE && content[2]
!== 0xBB) {
+                fs.writeFileSync(filePath, '\ufeff' + content);
+            }
+        });
     }
 };


Mime
View raw message