Github user vladimir-kotikov commented on a diff in the pull request:

    https://github.com/apache/cordova-medic/pull/92#discussion_r60209962
  
    --- Diff: medic/medic-appium.js ---
    @@ -222,6 +223,37 @@ function getLocalCLI(appPath) {
         return "./cordova";
     }
     
    +function getConfigPath(appPath) {
    +    return path.join(appPath, "config.xml");
    +}
    +
    +function parseElementtreeSync(filename) {
    +    var contents = fs.readFileSync(filename, util.DEFAULT_ENCODING);
    +    if(contents) {
    +        // Skip the Byte Order Mark (BOM)
    +        contents = contents.substring(contents.indexOf("<"));
    +    }
    +    return new elementTree.ElementTree(elementTree.XML(contents));
    +}
    +
    +function setPreference(appPath, preference, value) {
    +    var configFile = getConfigPath(appPath);
    +    var xml = parseElementtreeSync(configFile);
    +    var pref = xml.find("preference[@name=\"" + preference + "\"]");
    +
    +    util.medicLog("Setting \"" + preference + "\" preference to \"" + 
value + "\"");
    --- End diff --
    
    Conside using single quotes to avoid escaping


---
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