Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-14153

overwrite mode for edit-config in plist-helper.js

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • cordova-common@2.2.3
    • None
    • cordova-common
    • Important

    Description

      overwrite mode for *-Info.plist, as part of edit-config configuration, is not implemented in plist-helper.js file. 

      I want to override certain elments in the plist file. I added edit-config for the element. Instead of overriding it is merging the children.

      I am using cordova@8.0

      I have given a temporary fix in my local system.

       

      function graftPLIST (doc, xml, selector, mode) {
      var obj=plist.parse('<plist>'xml'</plist>');
      var node=doc[selector];
      if (node&&Array.isArray(node) &&Array.isArray(obj)) {
      //temporary fix
            (mode == 'overwrite') ? (node = obj) : (node = node.concat(obj));
      for (vari=0; i<node.length; i++) {
      for (varj=i+1; j<node.length; ++j) {
      if (nodeEqual(node[i], node[j])) { node.splice(j--, 1); }
      }
      }
      doc[selector] =node;
      } else {
      // plist uses objects for <dict>. If we have two dicts we merge them instead of
      // overriding the old one. See CB-6472
      if (node&&__.isObject(node) &&__.isObject(obj) &&!__.isDate(node) &&!__.isDate(obj)) { // arrays checked above
      __.extend(obj, node);
      }
      doc[selector] =obj;
      }
      
      returntrue;
      }
      

      Thanks

      Attachments

        Activity

          People

            Unassigned Unassigned
            AUK4JIRA Uday Kiran
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 10h
                10h
                Remaining:
                Remaining Estimate - 10h
                10h
                Logged:
                Time Spent - Not Specified
                Not Specified