CB-7347 Improve cordova platform add /path/to handling

split name/path errors


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

Branch: refs/heads/master
Commit: 586d8744ceb7cd36177c45d73f9dd68c43e249fb
Parents: ea717cb
Author: Josh Soref <jso...@blackberry.com>
Authored: Tue Aug 19 12:13:59 2014 -0400
Committer: Anis Kadri <a...@apache.org>
Committed: Fri Sep 5 11:12:19 2014 -0700

----------------------------------------------------------------------
 cordova-lib/src/cordova/platform.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/586d8744/cordova-lib/src/cordova/platform.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/platform.js 
b/cordova-lib/src/cordova/platform.js
index 7a01783..58e7f24 100644
--- a/cordova-lib/src/cordova/platform.js
+++ b/cordova-lib/src/cordova/platform.js
@@ -350,12 +350,16 @@ function platform(command, targets, opts) {
             var pPath = path.resolve(t);
             if (fs.existsSync(pPath)) return;
             // Neither path, nor platform name - throw.
-            var msg = 'Platform "' + t +
+            var msg;
+            if (/[~:/\\.]/.test(t)) {
+                msg = 'Platform path "' + t + '" not found.';
+            } else {
+                msg = 'Platform "' + t +
                 '" not recognized as a core cordova platform. See `' +
                 cordova_util.binname + ' platform list`.'
                 ;
+            }
             throw new CordovaError(msg);
-
         });
     } else if (command == 'add' || command == 'rm') {
         msg = 'You need to qualify `add` or `remove` with one or more 
platforms!';

Reply via email to