Github user omefire commented on a diff in the pull request:

    https://github.com/apache/cordova-lib/pull/148#discussion_r23428777
  
    --- Diff: cordova-lib/src/cordova/platform.js ---
    @@ -71,102 +72,98 @@ function add(hooksRunner, projectRoot, targets, opts) {
     
         // The "platforms" dir is safe to delete, it's almost equivalent to
         // cordova platform rm <list of all platforms>
    -    if ( !fs.existsSync(platformsDir)) {
    +    if (!fs.existsSync(platformsDir)) {
             shell.mkdir('-p', platformsDir);
         }
     
         return hooksRunner.fire('before_platform_add', opts)
    -    .then(function() {
    -        return promiseutil.Q_chainmap(targets, function(target) {
    +    .then(function () {
    +        return promiseutil.Q_chainmap(targets, function (target) {
                 // For each platform, download it and call its "create" script.
                 var parts = target.split('@');
                 var platform = parts[0];
                 var version = parts[1];
     
    -            return Q.when().then(function() {
    +            return Q.when().then(function () {
                     if (!(platform in platforms)) {
    -                    return getPlatformDetailsFromDir(target);
    -                } else {
    +                    // First, try handling 'platform' as a directory, if 
it fails, try handling it as a git repository
    +                    return Q.fcall(function () {
    +                        return util.getPlatformDetailsFromDir(target);
    +                    }).fail(function (err) {
    +                        // Maybe it's a git repo
    --- End diff --
    
    No. The error message would be: 'Unable to add platform android. Make sure 
to provide a valid version, an existing folder or an accessible git repository: 
'. so, we don't need the check.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to