cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [6/8] git commit: CB-6088: look for config.xml in www_dir and in project_dir
Date Fri, 21 Feb 2014 22:39:42 GMT
CB-6088: look for config.xml in www_dir and in project_dir


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

Branch: refs/heads/master
Commit: 09bd05383075d1f8d65d4e01e528156432677fc4
Parents: ad2b3a7
Author: ignisvulpis <axel@nennker.de>
Authored: Fri Feb 21 22:24:01 2014 +0100
Committer: ignisvulpis <axel@nennker.de>
Committed: Fri Feb 21 22:24:01 2014 +0100

----------------------------------------------------------------------
 src/platforms/firefoxos.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugman/blob/09bd0538/src/platforms/firefoxos.js
----------------------------------------------------------------------
diff --git a/src/platforms/firefoxos.js b/src/platforms/firefoxos.js
index b8f6e55..2534095 100644
--- a/src/platforms/firefoxos.js
+++ b/src/platforms/firefoxos.js
@@ -1,4 +1,5 @@
 var path = require('path')
+    , fs = require('fs')
     , common = require('./common');
 
 module.exports = {
@@ -6,7 +7,21 @@ module.exports = {
         return path.join(project_dir, 'www');
     },
     package_name:function(project_dir) {
-        var config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+        // preferred location if cordova >= 3.4
+        var preferred_path = path.join(project_dir, 'config.xml');
+        if (!fs.existsSync(preferred_path)) {
+            // older location
+            old_config_path = path.join(module.exports.www_dir(project_dir), 'config.xml');
+            if (!fs.existsSync(old_config_path)) {
+                // output newer location and fail reading
+                config_path = preferred_path;
+                require('../../plugman').emit('verbose', 'unable to find '+config_path);
+            } else {
+                config_path = old_config_path;
+            }
+        } else {
+            config_path = preferred_path;
+        }
         var widget_doc = xml_helpers.parseElementtreeSync(config_path);
         return widget_doc._root.attrib['id'];
     },


Mime
View raw message